/*
 * Carshow user interface class.  Provides display for carshow appl. to user.
 *
 */

/*
 * CarShowUI.java
 *
 * Created on Apr 1, 2011, 11:55:45 AM
 * @author Wayne Motycka waynemot<at>msn.com
 * @author Dennis O'Melia
 */

package carshow;
//import com.mysql.jdbc.Statement;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.print.PageFormat;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.math.BigInteger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.text.*;
import javax.swing.text.html.CSS;
import javax.xml.bind.*;

/**
 *
 * @author Wayne Motycka
 * @author Dennis O'Melia
 */
public class CarShowUI extends javax.swing.JFrame {
    private static final Logger logger = Logger.getLogger("carshow.CarShowUI");
    /* Set the hosting car club name that appears on the forms here */
    /* At some point it may be desirable to make this settable on the admin panel */
    /** Name of the host offering the SQLiteQS server instance */
    private String SQLServer = CarShowConstants.defaultServer;
    private String ServerUser = null;
    private String UserPassword = null;
    private String DBname = null;
    private String DBport = null;
    private boolean debug = false;
    private String myIpAddress = null;
    private boolean in_init = false;
    private boolean in_update = false;
    private boolean ThisEntrantPrinted = false;
    private boolean newScoreEntry = false;
    private boolean waitLit = false;
    private boolean rptPoll = false;
    private boolean focusSearch = false; // used to indicate a tab-out entrant # search
    private boolean awardsChanged = false;
    private boolean failedWait = false;
    private boolean validServer = false;
    private boolean winHost = false;
    private boolean carClassesDiffer = false;
    private java.sql.Connection DBconn = null;
    private String[] activeClubs = null;
    private String[] activeClasses = null;
    //private static String auditResult = null;
    private String currentJudgingEntrant = null;
    private String CurrentCarShowName = null;
    private String CarShowDate = null;
    private String saveTable = null;
    private String HostClub = CarShowConstants.HostingClubName;
    //private static int auditCode = -1;
//    private static int waitsCount = 15;  // # of 300ms cycles to wait for Wait indicators
    private ActionListener rptActionListener; // report cycling action listener
    private javax.swing.Timer rTimer = null; // refresh timer judge scoring report
//    private java.awt.Component actDefaultButton = null;
    private java.awt.Color oldPrintColor;
    /** a list of all fields on the judging sheet panel */
    private java.util.List<javax.swing.JTextField> JudgingFields;
    /** a container of all the fields on the registration panel */
    private java.util.HashMap<String, javax.swing.JComponent> EntrantFields;
    /** a list of all the award check-boxes on the judging sheet */
    private java.util.List<javax.swing.JCheckBox> AwardsBoxes;
    /** a mapping of the award to winner name */
    private java.util.HashMap<String, String> SpecialAwards;
    /** a mapping of the sharable awards? */
    private java.util.HashMap<String,String> AwardsShared;
//    private HashMap<String, String> currInsArgs;
    private Preferences preferences;
    // class table descriptor, really just defines the columns.  We
    // do this manually because we want to have a shortcut to the model
    // that we can manipulate later with column mods.  This can also be
    // done in-line, but I thought at one time I wanted further capability
    // to the table which I'm getting most of for free in the default handlers
    private javax.swing.table.DefaultTableModel ClassTableModel
        = new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null}
            },
            new String [] {
                "Class", "Class Description", "Start Year", "End Year"
            }
        );

    /** Creates new form CarShowUI */
    public CarShowUI() {
        java.util.logging.Handler fh = null;
        try {
            fh = new java.util.logging.FileHandler("CarShowUI%u.log");
        } catch (IOException ex) {
            logger.log(Level.SEVERE, 
                "failed to create file handler logger for CarShowUI", ex);
        } catch (SecurityException ex) {
            logger.log(Level.SEVERE, 
                "falied to create file handler logger for CarShowUI", ex);
        }
        logger.addHandler(fh);
        logger.setLevel(Level.FINE);
        in_init = true;
        initPreferences(); // initialize the preferences & set class globals
        if(ServerUser == null) ServerUser = CarShowConstants.DBuserName;
        if(UserPassword == null) UserPassword = CarShowConstants.DBpassword;
        boolean connResult = checkConnection();  // test if jdbc connection is working
        boolean ret = false;
        if(connResult) ret = initDB("Audit");
        if(!ret && connResult) {
            logger.log(Level.SEVERE,"CarShowUI constructor DB init fail");
        }
        setIpAddress();
        initAwards();
        initComponents();
        setAwardsButtonList();  // init table used to eval Awards button
        if(connResult) initAwardBoxes();
        if(connResult) getAdminData();
        this.setTitle("The __"+this.HostClub+"__ Car Show");
        in_init = false;
        setJudgeSheetList();    // init table used to examine JudgingSheet panel
        setEntrantFieldsList(); // init table used to eval Registration panel
        if(connResult) {
            if(auditClasses()) this.carClassesDiffer = true; //initDBClasses(false);
        } // Compare preferences.xml classes to DB classes
        if(this.carClassesDiffer) {
            int classres = JOptionPane.showConfirmDialog(tabbedPane,
                    "Current car scoring classes database differs from the "+
                    "database supplied by the preferences.xml file.\n "+
                    "\nShould we use the preferences.xml values?",
                    "Car Class Initialization", JOptionPane.YES_NO_OPTION, 
                    JOptionPane.QUESTION_MESSAGE);
            if(classres == JOptionPane.YES_OPTION)  {
                //System.out.println("user selected to reset car classes from preferences.xml");
                logger.log(Level.INFO,"user selected preferences.xml car classes reset in constructor");
                initPrefClasses(false);
                initClassList();
            }
        }
        if(connResult) initRegistration();
        formatClassTable();   // format displayed classes admin table
        formatJudgingTable(); // format the displayed (refreshed) judging tbl
        formatAwardsTable();  // format the displayed show results/awards table
        setRegFocusTraversal(); // get the desired order of tabs on Reg panel
        oldPrintColor = RegPrint.getForeground();
        RegPrint.setVisible(false); // hide the print button
        EntrantDeleteButton.setEnabled(false);
        // This is used to remap the default action button
        //actDefaultButton = getRootPane().getDefaultButton(); 
        KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        manager.addKeyEventPostProcessor(new typedKeyListener());
        if(!connResult) {
            tabbedPane.setSelectedIndex(5);
            ScoringServerName.setBackground(Color.RED);
        }
        else {
            ScoringServerName.setBackground(Color.GREEN);
        }
        if(connResult && (ScoringServerName.getText().equals(CarShowConstants.defaultServer) ||
                SQLServer.equals(getLocalIP()))) {
            ResetEntrantLabel.setVisible(true);
            ResetEntrantDataButton.setVisible(true);
            ArchiveEntrantLabel.setVisible(true);
            ArchiveEntrantDataButton.setVisible(true);
        }
        else {
            ResetEntrantLabel.setVisible(false);
            ResetEntrantDataButton.setVisible(false);
            ArchiveEntrantLabel.setVisible(false);
            ArchiveEntrantDataButton.setVisible(false);
        }
    }

    /**
     * get data from the SQL server.  Replies from the server are
     * passed to the dispatchSQL() method which handles populating
     * the correct screen/form.
     * 
     * @param act_form active form name (via getName())
     * @param dest component data will be put on (combo box, JPane, JTable)
     * @param request
     * @return
     
    private boolean sqlGet(Component dest, String request) {
        java.util.Stack<String> resultStack = new java.util.Stack();
        //dest.setName(act_form); // name the JComponent for reader thread
        ((myJTabbedPane)tabbedPane).setActiveComponent(dest);
        if (DBconn == null) connect();
        //System.err.println("sqlGet: DEBUG, opening out to server printwriter");
        try {
            if (DBconn.isClosed()) {
                logger.log(Level.SEVERE,"UI sqlGet: socket is closed!");
                clientSocketError(-2);
                return false;
            }
            else if(debug) logger.log(Level.INFO,"UI sqlGet: socket is open...");
            }
        catch (java.sql.SQLException sqle) {
            logger.log(Level.SEVERE,"DB closed request caused SQLE",sqle);
            return false;
        }

        if(debug) {
            logger.log(Level.INFO,"sqlGet: sending request: {0}",request);
        }
        java.sql.Statement stmt = null;
        java.sql.ResultSet rs = null;
        try {
           stmt = DBconn.createStatement();
           //stmt.addBatch(request);
           rs = stmt.executeQuery(request);
           
        }
        catch (java.sql.SQLException sqle) {
            logger.log(Level.SEVERE,"DB execQuery caused SQLE on request: "
                +request,sqle);
            return false;
        }
        if(rs != null) {
            String[] vals = null;
            int numcols = -1;
            try {
                java.sql.ResultSetMetaData rsmd = rs.getMetaData();
                numcols = rsmd.getColumnCount();
            }
            catch (SQLException sqle) {
                logger.log(Level.SEVERE,"result set metadata read caused SQLE",sqle);
                return false;
            }
            try {
                while(rs.next()) {
                    StringBuilder sb = new StringBuilder();
                    // NOTE SQL result set Col #'s start with 1 not 0 !!!
                    for(int i = 1; i <= numcols; i++) {
                        //String s = rs.getString(i);
                        sb.append(rs.getString(i));
                        if(i < numcols) sb.append(",");
                    }
                    resultStack.push(sb.toString());
                }
            }
            catch (SQLException sqle) {
                logger.log(Level.SEVERE,"DB executeBatch(request) caused SQLE",sqle);
                return false;
            }
            if(resultStack.empty()) {
                dispatchSQL(null);
            }
            else {
                vals = new String[resultStack.size()];
                int cntr = 0;
                while(!resultStack.empty()) {
                    vals[cntr++] = resultStack.pop();
                }
                dispatchSQL(vals); // handle destinsation of output
            }
            // parse the result set back to the requesting "dest" panel
        }
        return true;
    } */
    
    /**
     * This is the selector for the data returned by the sqlGet()
     * DB request.  It matches the functions we use in the original design
     * which was handled by the SqlClientReader class in that version.
     * This method uses the active_panel to determine which screen to
     * populate with the provided string array of values (SQL data).
     * The screen to populate is provided to sqlGet() when the data is
     * requested.
     * @param vals 
     */
    @Deprecated
    private void dispatchSQL(String[] vals) {
        String active_panel = ((myJTabbedPane)tabbedPane).getActiveComponent().getName();
        if(active_panel == null|| active_panel.equals("") ) {
            // error or init condition here...
        }
        else if (active_panel.equals("RegistrationPanel")) {
            if(vals == null) setEntrant(new HashMap[0]);
            else if(vals.length == 1 && vals[0].contains(",")) setEntrant(vals[0]);
            else if(vals.length == 1) {
                updEntrant(vals[0]);
            }
            else if(vals.length > 1) setMultiEntrant(vals);
        }
        else if (active_panel.equals("EntrantClass")) {
            setRegClasses(vals);
        }
        else if (active_panel.equals("EntrantClub")) {
            setRegClubs(vals);
        }
        else if (active_panel.equals("JudgingPanel")) {
            setJudgePanel(vals);
        }
        else if (active_panel.equals("JudgeSubPanel")) {
            setJudgingData(vals);
        }
        else if (active_panel.equals("JudgeSheetPanel")) {
            setJudgingEntrant(vals);
        }
        else if (active_panel.equals("JudgeSheetSubPanel")) {
            setJudgingData(vals);
        }
        else if (active_panel.equals("ReportTable")) {
            if(vals == null || vals.length == 0) {
                // setAwardsSaveResult("-9");
                logger.log(Level.WARNING,"empty (null) save result set for entrants");
            }
            //else if (vals.length == 1) setAwardsSaveResult(vals[0]);
            else {
                setAwardsSaveResult(vals);
            }
        }
        else if (active_panel.equals("AwardsPanel")) {
            setAwardsPanel(vals);
        }
        else if (active_panel.equals("MostClubMembers")) {
            setClubAward(vals);
        }
        else if (active_panel.equals("specialtyAwardsLabel")) {
            updateSpecialAwards(vals);
        }
        else if(active_panel.equals("AdminPanel")) {
            // set the values from the result set using setContestResult
            // as an sql comma separated string
            if(vals == null || vals.length == 0) {
                setContestResult("0");
            }
            else {
                setContestResult(vals[0]);
            }
        }
        else if (active_panel.equals("ClassListTable")) {
            setClassList(vals);
        }
        else if (active_panel.equals("EntrantClear")) {
            setEntrant(new HashMap[0]);
        }
        else if (active_panel.equals("RegPrint")) {
            updatePrintStatus(vals[0]);
        }
        else {
            logger.log(Level.WARNING,"Unknown destination for SQL response: {0}",active_panel);
            ((myJTabbedPane)tabbedPane).clearActiveComponent(
                ((myJTabbedPane)tabbedPane).getActiveComponent());
            ((myJTabbedPane)tabbedPane).clearWait();
        }
    }
    /**
     * put a record into the SQL database associated the output with the
     * specified Component.
     * @param comp GUI component where the output belongs
     * @param request SQL request
     * @return 0 on success, negative on error
     */
/*    private int sqlPut(Component comp, String request) {
        if(taskStackStatus(false)) { taskStackStatus(true); }
        ((myJTabbedPane)tabbedPane).setActiveComponent(comp);
        int ret = sqlPut(request);
        String[] sret = new String[1];
        // rather than have the dispatchSQL method schedule this DB request,
        // instead we will do it here.  Originally, we would only return the
        // entrant #, but the form wasn't updating the entrant's class when
        // it was left empty (initted to PRE actually) so I wanted to fix that
        // although..
        String tbl;
        if(winHost) tbl = CarShowConstants.winEntrants;
        else tbl = CarShowConstants.Entrants;
        if(request.contains("insert") && request.contains(tbl)) {
            currInsArgs = parseInsert(request);
            ret = getLastEntrantNum(currInsArgs);
            String nreq = "select * from "+tbl+
                " where entrant_num = "+ret+";";
            ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
            //sqlGet(RegistrationPanel, nreq);
            HashMap[] rs = getDBData(nreq);
            setEntrant(rs);
        }
        else {
            sret[0] = Integer.toString(ret);
            dispatchSQL(sret);
        }
        return ret;
    } */
    
    
    /**
     * puts a record into the SQL database
     * @param request SQL string
     * @return success or failure 0, -1
     */
/*    private int sqlPut(String request) {
        if (DBconn == null) connect();
        //System.err.println("sqlPut: DEBUG, opening out to server printwriter");
        try {
        if (DBconn.isClosed()) {
            logger.log(Level.SEVERE,"sqlPut: socket is closed! request: {0} "+
                    "server: {1}",new Object[]{request,SQLServer});
            clientSocketError(-2);
            return -1;
        }
        else if(debug) logger.log(Level.INFO,"UI sqlPut: socket is open...");
        }
        catch (java.sql.SQLException sqle) {
            logger.log(Level.SEVERE,"DB closed request caused SQLE",sqle);
            return -1;
        }

        if(debug) { 
            logger.log(Level.INFO,"sqlPut: sending request: {0}",request);
        }
        java.sql.Statement stmt = null;
        int ret = -1;
        try {
            stmt = DBconn.createStatement();
            ret = stmt.executeUpdate(request);
        }
        catch (SQLException sqle) {
            logger.log(Level.INFO,"sqlPut: sqle on request: {0}",request);
            logger.log(Level.SEVERE,"DB execUpdate failed with SQL Exception",sqle);
            ret = -1;
        }
        return ret;
    } */

/*    private int getLastEntrantNum(HashMap args) {
        int ret = -1;
        String tbl;
        if(winHost) tbl = CarShowConstants.winEntrants;
        else tbl = CarShowConstants.Entrants;
        String entNumRequest = "select entrant_num from " +
            tbl+" where fname = "+args.get("fname")+
            " and lname ="+args.get("lname")+" and address ="+
            args.get("address")+" and make="+args.get("make")+
            " and model ="+args.get("model")+" and year ="+
            args.get("year")+" and color ="+args.get("color")+";";
        //java.sql.ResultSet rs = execDBQuery(entNumRequest);
        HashMap[] rs = getDBData(entNumRequest);
        if(rs != null && rs.length > 0) {
            HashMap<String,String> rv = rs[0];
            if(rv.containsKey("entrant_num"))
                ret = Integer.parseInt(rv.get("entrant_num"));
        }
        return ret;
    } */
    
    /**
     * method to send the Audit command during init to check & build a
     * DB on startup.  This method also informs the rest of the system
     * the type of DB support provided, case sensitive or non-case sensitive
     * through the winHost class-level boolean being set.
     */
    private boolean initDB(String request) {
        boolean ret = true;
        boolean have_ent = false, have_class = false, have_score = false;
        boolean have_clubs = false, have_specials = false, have_show = false;
        boolean have_archive = false;
        if (DBconn != null) disconnect();
        checkDBName();
        connect();
        
        //if(debug)  { 
            logger.log(Level.INFO,"initDB: sending request: {0}",request); 
        //}
        DatabaseMetaData dmd = null;
        try {
          dmd = DBconn.getMetaData();  
        }
        catch (SQLException sqle) {
            logger.log(Level.SEVERE,"initDB: DB metadata get failed",sqle);
            return false;
        }
        boolean stores = false;
        try {
            stores = dmd.storesMixedCaseIdentifiers();
        }
        catch (SQLException sqle) {
            logger.log(Level.SEVERE,"initDB: DB metadata get failed",sqle);
            return false;
        }
        if(stores) winHost = false;
        else winHost = true;
        String[] types = {"TABLE"};
        try {
            java.sql.ResultSet rs = dmd.getTables(this.DBname,null,"%",types);

            while(rs.next()) {
                // Parse the Table names to find if we have all the tables rqd.
                String table = rs.getString("TABLE_NAME");
                if(table.equalsIgnoreCase(CarShowConstants.winEntrants)) {
                    have_ent = true;
                }
                else if(table.equalsIgnoreCase(CarShowConstants.winClubs)) {
                    have_clubs = true;
                }
                else if(table.equalsIgnoreCase(CarShowConstants.winScoring)) {
                    have_score = true;
                }
                else if(table.equalsIgnoreCase(CarShowConstants.winJudgeClasses)) {
                    have_class = true;
                }
                else if(table.equalsIgnoreCase(CarShowConstants.winSpecials)) {
                    have_specials = true;
                }
                else if(table.equalsIgnoreCase(CarShowConstants.winShowData)) {
                    have_show = true;
                }
                else if(table.equalsIgnoreCase(CarShowConstants.winArchiveData)) {
                    have_archive = true;
                }
            }
            rs.close();
        }
        catch (SQLException sqle) {
            logger.log(Level.SEVERE,"initDB: DB metadata get failed",sqle);
            return false;
        }
        if(!have_ent) {
            ret &= (execDBUpdate(CarShowConstants.createEntrants) >= 0) ? true : false;
        }
        if(!have_class) {
            ret &= (execDBUpdate(CarShowConstants.createJudgeClasses) >= 0) ? true : false;
            initDBClasses(true);
        }
        if(!have_score) {
            ret &= (execDBUpdate(CarShowConstants.createScoring) >= 0) ? true : false;
        }
        if(!have_clubs) {
            ret &= (execDBUpdate(CarShowConstants.createClubs) >= 0) ? true : false;
            execDBUpdate(CarShowConstants.addHostClub);
        }
        if(!have_specials) {
            ret &= (execDBUpdate(CarShowConstants.createSpecials) >= 0) ? true : false;
        }
        if(!have_show) {
            ret &= (execDBUpdate(CarShowConstants.createShowData) >= 0) ? true : false;
        }
        if(!have_archive) {
            ret &= initArchive();
        }
        return ret;
    }

    /**
     * Initialize the entrant data archive DB table.  This method permits
     * creating the entrant archive if it currently does not exist.
     */
    
    private boolean initArchive() {
        if(debug) System.out.println("initArchive SQL: "+CarShowConstants.createArchive);
        return (execDBUpdate(CarShowConstants.createArchive) > 0) ? true : false;
    }
    
    /**
     * Reset the tables associated with the current car show.  This is the
     * backing code to the the reset show button on the admin panel.  
     */
    private boolean resetShow() {
        boolean ret;
        // use these fancy inline if statements that eval the ret code to derive boolean
        ret = (execDBUpdate(CarShowConstants.resetEntrants) > 0) ? true : false;
        ret &= (execDBUpdate(CarShowConstants.resetScores) > 0) ? true : false;
        ret &= (execDBUpdate(CarShowConstants.resetSpecials) > 0) ? true : false;
        if(preferences != null) {
            initAwards();
        }
        return ret;
    }
    
    private boolean tableExists(String tbl) {
        boolean ret = false;
        DatabaseMetaData dmd;
        try {
            if(DBconn == null) connect();
            dmd = DBconn.getMetaData();
            String[] types = {"TABLE"};
            java.sql.ResultSet rs = dmd.getTables(this.DBname,tbl,"%",types);
            while(rs.next()) {
                String tablename = rs.getString("TABLE_NAME");
                if(tablename.equalsIgnoreCase(tbl)) {
                    ret = true;
                    break;
                }
            }
        } catch (SQLException sqle) {
            logger.log(Level.SEVERE,"tableExists: SQL exception on tablename: {0}, {1}",
                new Object[]{tbl, sqle});
        }
        return ret;
    }
    
    /**
     * Execute an SQL Database update request (insert/update/delete operations)
     * @param request SQL statement to execute
     * @return return code from the executeUpdate() SQL API method
     */
    private int execDBUpdate(String request) {
        int ret = 0;
        java.sql.Statement stmt = null;
        try {
            stmt = DBconn.createStatement();        
        }
        catch (SQLException sqle) {
            logger.log(Level.SEVERE,"initDB: create stmt SQL Exception",sqle);
            return -1;
        }
        if(stmt != null) {
            try {
                int x = stmt.executeUpdate(request);
                if(x >= 0) ret = x;
                else ret = 0;
            }
            catch (SQLException sqle) {
               logger.log(Level.SEVERE,"execDBUpdate: execUpdate() SQL Exception",sqle);
               logger.log(Level.INFO,"initTable: request: {0}",request);
                return -1; 
            }
        }
        return ret;
    }
    /**
     * executes the executeUpdate() method on a DB Statement object using the
     * supplied SQL request string.
     * @param request SQL request to be issued for the DB update
     * @return true if update succeeded, otherwise false
    @Deprecated 
    private boolean execDBUpdate(String request) {
        boolean ret = false;
        java.sql.Statement stmt = null;
        try {
            stmt = DBconn.createStatement();        
        }
        catch (SQLException sqle) {
            logger.log(Level.SEVERE,"initDB: create stmt SQL Exception",sqle);
            return false;
        }
        if(stmt != null) {
            try {
                int x = stmt.executeUpdate(request);
                if(x >= 0) ret = true;
                else ret = false;
            }
            catch (SQLException sqle) {
               logger.log(Level.SEVERE,"initTable: create stmt SQL Exception",sqle);
                return false; 
            }
        }
        return ret;
    } */
    
    /**
     * executes the executeQuery() method on a DB statement using the
     * specified request string.  This is a truly private method because
     * the ResultSet object is an SQL volatile object and it locks the DB
     * while open, so this should only be called by getDBData().
     * @param request SQL request string to be executed
     * @return ResultSet object resulting from the SQL request
     */
    private java.sql.ResultSet execDBQuery(String request) {
        java.sql.ResultSet rs = null;
        java.sql.Statement stmt;
        
        try {
            stmt = DBconn.createStatement();        
        }
        catch (SQLException sqle) {
            logger.log(Level.SEVERE,"initDB: create stmt SQL Exception",sqle);
            return null;
        }
        if(stmt != null) {
            try {
                
                rs = stmt.executeQuery(request);
            }
            catch (SQLException sqle) {
               logger.log(Level.SEVERE,"initTable: create stmt SQL Exception",sqle);
                return null; 
            }
        }
        return rs;
    }
    
    /**
     * Get the DB data from a SQL request back as a hash map of strings.
     * The advantage to this method is the quick closure of the result sets
     * because these are actually modifiable objects which can result in DB
     * locks that block other workstations.  This is the open
     * interface that front-ends for execDBQuery()
     * 
     * @param request SQL request string of query
     * @return HashMap of String key, String value pairing of query output
     */
    public HashMap[] getDBData(String request) {
        HashMap[] ret;
        java.util.Stack<HashMap> tmpstack = new java.util.Stack<HashMap>();
        java.sql.ResultSet rs = execDBQuery(request);
        if(rs == null) return new HashMap[0];
        try {
            java.sql.ResultSetMetaData rsmd = rs.getMetaData();
            while(rs.next()) {
                HashMap current = new HashMap<String,String>();
                for(int i = 1; i <= rsmd.getColumnCount(); i++) {
                    String colname = rsmd.getColumnName(i);
                    int type = rsmd.getColumnType(i);
                    if(type == java.sql.Types.INTEGER) {
                        current.put(colname,Integer.toString(rs.getInt(i)));
                    }
                    else if (type == java.sql.Types.FLOAT) {
                        // Allow for a floating point value in future for tie-breaking
                        current.put(colname, Float.toString(rs.getFloat(i)));
                    }
                    // Add else-if for tie-breaker floats here...
                    else {
                        current.put(rsmd.getColumnName(i), rs.getString(i));
                    }
                }
                tmpstack.add(current);
            }
        } catch (SQLException ex) {
            Logger.getLogger(CarShowUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            rs.close();
        } catch (SQLException ex) {
            Logger.getLogger(CarShowUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        ret = new HashMap[tmpstack.size()];
        // because the stack element locations are LIFO, we need to reverse this
        //for(int k = 0; k < tmpstack.size(); k++) {
        int rcnt = 0;
        for(int k = tmpstack.size()-1; k >= 0; k--) {
            ret[rcnt++] = tmpstack.elementAt(k);
        }
        return ret;
    }
    
    /**
     * Audit the state of the car judging classes.  This method compares the
     * existing car classes in the DB to those supplied in the preferences.xml
     * file.  If a difference is detected, this method returns true.  This
     * method is only applicable on the 'localhost' server system.  All other
     * workstations rely on the DB data exclusively for car class data.
     * An additional capability this adds is when reusing the preferences.xml from
     * a previous year's show, this will automatically detect the year change
     * and update the car judging classes table with the current year.
     * @return true if car classes in DB differ from the preferences.xml values
     */
    private boolean auditClasses() {
        // Only applicable for the localhost, other workstations use DB data
        // make it smart enough to know what the local host name is
        String laddr = getLocalIP();
        if((!this.SQLServer.equals("localhost") && !this.SQLServer.equals(laddr))
                || !validServer) { // if not connected/invalidServer or
            return false; // this machine isnt the MySql server, skip audit
        }
        GregorianCalendar gc = new GregorianCalendar();
                if(this.preferences != null) {
            if(preferences.getClassesList() != null) {
                java.util.List<CarClass> cl = preferences.getClassesList().getClazz();
                if(cl.size() > 0) {
                    String request = "SELECT * FROM "+CarShowConstants.JudgeClasses+";";
                    HashMap[] dbclasses = getDBData(request);
                    boolean found = false;
                    int s1 = dbclasses.length;
                    int s2 = cl.size();
                    boolean[] which;
                    if(s1 != s2) {
                        // guaranteed different class sets
                        this.carClassesDiffer = true;  
                    }
                    else {
                        if(s1 > s2) which = new boolean[s1];
                        else which = new boolean[s2]; // size the array of which classes were found
                        for(int i = 0; i < dbclasses.length; i++) {
                            found = false;
                            HashMap hm = dbclasses[i];
                            Iterator<CarClass> it = cl.iterator();
                            while(it.hasNext()) {
                                CarClass currClass = it.next();
                                if(currClass.startyear == null) // empty start/endyear handling
                                    currClass.setStartyear(new BigInteger("1886"));
                                if(currClass.endyear == null)
                                    currClass.setEndyear(new BigInteger(String.valueOf(gc.get(Calendar.YEAR))));
                                if(hm.get("mnemonic").equals(currClass.mnemonic) &&
                                      hm.get("classname").equals(currClass.description) &&                                       
                                      hm.get("StartYear").equals(currClass.startyear.toString()) &&
                                      hm.get("EndYear").equals(currClass.endyear.toString())) {
                                    found = true;
                                    break;
                                }
                            }
                            which[i] = found;
                        }
                        for(int k = 0; k < which.length; k++) {
                            if(which[k]) continue;
                            else {
                                this.carClassesDiffer = true;
                                logger.log(Level.INFO,"auditClasses: different classes found at position {0}",k);
                                break;
                            }
                        }
                    }
                }
            }
        }
        return this.carClassesDiffer;
    }
    /**
     * Initialize the car show car classes.  If the Preferences file,
     * <code>preferences.xml</code>, contains classes table data, initialize
     * to the class values supplied there.  Otherwise use the default car class
     * set originally specified by the Rebels Car Club.
     */
    private void initDBClasses(boolean newDB) {
        java.util.List<CarClass> cl;
        if(preferences != null) {
            cl = preferences.getClassesList().getClazz();
            if(!cl.isEmpty()) // Prefer the Preferences settings over defaults
                initPrefClasses(newDB);
        }
        else
            initDefaultClasses(newDB);
    }
    
    /**
     * Initializes car classes database using the default class set.  Existing
     * car classes in the DB will be deleted and replaced.
     */
    private void initDefaultClasses(boolean newDB) {
        PreparedStatement prep;
        GregorianCalendar gc = new GregorianCalendar();
        
        if (DBconn == null) connect();
        try {
            //clear the existing car classes table
            if(!newDB)
                execDBUpdate(CarShowConstants.resetCarClasses);
            prep = DBconn.prepareStatement(CarShowConstants.classAddPrepStmt);
            String[][] defaults = CarShowConstants.defaultClassList;
            for(int i = 0; i < defaults.length; i++) {
                for(int j = 0; j < defaults[i].length-1; j++) {
                    if(j==2) prep.setInt(j+1,Integer.parseInt(defaults[i][j]));
                    else prep.setString(j+1,defaults[i][j]);
                }
                if(defaults[i][defaults[i].length-1].isEmpty())
                    prep.setInt(defaults[i].length, gc.get(Calendar.YEAR));
                else
                    prep.setInt(defaults[i].length, Integer.parseInt(defaults[i][3]));
                prep.addBatch();
            }

            DBconn.setAutoCommit(false);
            int[] rets = prep.executeBatch();
            DBconn.setAutoCommit(true);
            prep.close();
            if (rets.length != defaults.length) {
                logger.log(Level.WARNING,"initDefaultClasses: not all classes were "+
                    "initted, count is: {0}",rets.length);
            }
            if(rets.length > 0) {
                for(int i = 0; i < rets.length; i++) {
                    if(rets[i] < 0) {
                        logger.log(Level.WARNING,"initDefaultClasses: fail in class "+
                            "init element: {0}",i);
                    }
                }
            }
            this.carClassesDiffer = false;
        } catch (SQLException ex) {
            //System.err.println("SQLException on default class list create: "+ex.getMessage());
            logger.log(Level.SEVERE, "SQL Exception on default class list create", ex);
        }
    }
    
    /**
     * Initialize the car classes database from the values in the preferences.xml
     * data.  This method removes existing classes & replaces.
     */
    private void initPrefClasses(boolean newdb) {
        int exitCode = 0;
        if(!newdb) // exitCode can be 0, so ignore it for now...
            exitCode = execDBUpdate(CarShowConstants.resetCarClasses);
        if(exitCode < 0) logger.log(Level.WARNING,"SQLException on judgingClasses table reset");
        PreparedStatement prep;
        GregorianCalendar gc = new GregorianCalendar();
        java.util.List<CarClass> classes = preferences.getClassesList().getClazz();
        try {            
            prep = DBconn.prepareStatement(CarShowConstants.classAddPrepStmt);
            Iterator<CarClass> it = classes.iterator();
            while(it.hasNext()) {
                CarClass cc = it.next();
                prep.setString(1,cc.getMnemonic());
                prep.setString(2,cc.getDescription());
                int year = -1;
                if(cc.getStartyear()!= null) {
                    year = cc.getStartyear().intValue();
                    if(year > 0)
                        prep.setInt(3,year);
                }
                else prep.setInt(3,1886); // Set StartYear to 1886 Default
                if(cc.getEndyear() != null) {
                    year = cc.getEndyear().intValue();
                    if(year > 0)
                        prep.setInt(4,year);
                }
                else prep.setInt(4,gc.get(Calendar.YEAR));
                prep.addBatch();
            }
            DBconn.setAutoCommit(false);
            int[] rets = prep.executeBatch();
            DBconn.setAutoCommit(true);
            prep.close();
            if (rets.length != classes.size()) {
                logger.log(Level.WARNING,"initPrefClasses: not all classes "+
                    "were initted, count is: {0}",rets.length);
            }
            if(rets.length > 0) {
                for(int i = 0; i < rets.length; i++) {
                    if(rets[i] < 0) {
                        logger.log(Level.WARNING,"initDefaultClasses: fail in class "+
                            "init element: {0}: {1}", new Object[]{i, classes.get(i).getDescription()});
                    }
                }
            }
        }
        catch (SQLException ex) {
            //System.err.println("SQLException on default class list create: "+ex.getMessage());
            Logger.getLogger(CarShowUI.class.getName()).log(Level.SEVERE,
                "SQLException on default class list create", ex);
        }
        this.carClassesDiffer = false;
    }
    
    /**
     * Get the values from the preferences.xml file which override the
     * CarShowConstants defaults during initialization.  This permits
     * setting up non-default values for DB username/password, DB port
     * and DB server name/IP address.  This is a convenience measure to
     * permit deployment via automated scripts that generate the preferences.xml
     * for each client CarShow session/system.  If a preferences.xml file is
     * not provided or found in the local directory the defaults are used.
     * This routine verifies that there is a preferences file and parses the
     * DB connection information.  The car classes and special awards are applied
     * later in the initialization (CarShowUI constructor.)  This method sets
     * the <code>preferences</code> class variable that indicates whether a
     * preferences file exists (non-null) and provides the access to the values
     * to the class and award setting methods.
     * 
     * This method expects the preferences.xml to be in the current working
     * directory of the CarShowUI class, so co-locate the preferences.xml with
     * the CarShowUI jar file when deploying.
     */
    
    private void initPreferences() {
        /* NOTE:  This should be executed prior to attempting DB connect because
         * initalization values for the DB are stored in here for connection.
         * 
         */
        File dir = new File("."); 
        try {
            String file = dir.getCanonicalPath() + File.separator + "preferences.xml";
            File newFile = new File(file); 
            if(newFile.exists()){
                JAXBContext jc = JAXBContext.newInstance( new Class[] { carshow.ObjectFactory.class } );
                Unmarshaller um = jc.createUnmarshaller();
    		FileInputStream fStream = new FileInputStream(file);
                JAXBElement<Preferences> elem = (JAXBElement<Preferences>) um.unmarshal(fStream);
                this.preferences = elem.getValue();
                
    		if(this.preferences!=null){
                    String tmp = this.preferences.getServer();
                    if(tmp != null) this.SQLServer = tmp;
                    else this.SQLServer = CarShowConstants.defaultServer;
                    tmp = this.preferences.getUsername();
                    if(tmp != null) this.ServerUser = tmp;
                    else this.ServerUser = CarShowConstants.DBuserName;
                    tmp = this.preferences.getPassword();
                    if(tmp != null) this.UserPassword = tmp;
                    else this.UserPassword = CarShowConstants.DBpassword;
                    tmp = this.preferences.getDBName();
                    if(tmp != null) this.DBname = tmp;
                    else this.DBname = CarShowConstants.dbName;
                    tmp = this.preferences.getPort();
                    if(tmp != null) this.DBport = tmp;
                    else this.DBport = CarShowConstants.DBport;
                    tmp = this.preferences.getHostClubName();
                    if(tmp != null) { 
                        this.HostClub = tmp;
                    }
                    if(this.preferences.getAwards() != null) {
                        java.util.List<Award> awardsList = this.preferences.awards.getAwardsSet();
                        if(!awardsList.isEmpty()) {
                            // perform award panel init later
                            // updateAwardsLabels(); // labels on forms & report
                            // updateAwardsShares(); // which awards are sharable table
                            logger.log(Level.INFO, "getPreferences: awards specified in preferences: {0}", awardsList.size());
                        }
                    }
                    else logger.log(Level.INFO,"getPreferences: no awards specified");
                    if(this.preferences.getClassesList() != null) {
                        java.util.List<CarClass> classList = this.preferences.classesList.getClazz();
                        if(!classList.isEmpty()) {
                            logger.log(Level.INFO, "getPreferences: classes specified in preferences: {0}", classList.size());
                        }
                    }
                    else logger.log(Level.INFO,"getPreferences: no car classes specified");
                }
                else {
                    this.preferences = null;
                    logger.log(Level.SEVERE,"getPreferences: no preferences "+"found in {0}", newFile.getAbsolutePath());
                }
            }
            else {
                this.preferences = null;
                logger.log(Level.INFO, "getPreferences: {0} does not exist", newFile.getAbsolutePath());
            }
        } catch (IOException e) {
            this.preferences = null;
            logger.log(Level.SEVERE,"getPreferences: io exception: {0}",e);
        } catch (JAXBException jxbe) {
            this.preferences = null;
            logger.log(Level.SEVERE,"getPreferences: JaxB exception: {0}",jxbe);
        }
    }
    /**
     * Save the in memory version of preferences.xml to a new file
     * current_preferences.xml.  This allows creating a new preferences.xml
     * from the settings running on the executing system, without destroying
     * the current preferences.xml.  A show administrator could then replace
     * the preferences.xml with the current_preferences.xml, thus customizing
     * the preferences.xml file for this particular show and workstation.
     */
    private void savePreferences() {
        File dir = new File(".");
        if(this.preferences != null) {
            try {
                String file = dir.getCanonicalPath() + File.separator + "current_preferences.xml";
                File newFile = new File(file); 
                JAXBContext jc = JAXBContext.newInstance( new Class[] { carshow.ObjectFactory.class } );
                Marshaller m = jc.createMarshaller();
                ObjectFactory o = new carshow.ObjectFactory();
                JAXBElement e = o.createPreferences(this.preferences);
                m.marshal(e, newFile);
            } catch (IOException ioe) {
                logger.log(Level.WARNING,"savePreferences: IO Exception opening current_preferences.xml", ioe);
            } catch (JAXBException jxbe) {
                logger.log(Level.WARNING, "savePreferences: JAXB exception writing current_preferences.xml", jxbe);
            }
        }
    }
    /**
     * Initialize the Specials table in the DB if this is the master/SQL server
     * hosting system.  This is required prior to the initAwardBoxes() call
     * in the initialization chain.  The DB view controls what is visible on
     * the Awards panel for visible awards so this determines if the DB,
     * preferences, or the outright defaults set in the CarShowConstants class.
     */
    private void initAwards() {
        // Master host mode, initialize DB on mismatch, prompt for
        // override if DB Specials (awards) table _not_ empty.
        HashMap[] rs = null;
        if(validServer && (this.SQLServer.equals("localhost") || this.SQLServer.equals(getLocalIP()))) {
            if(preferences != null) {
                if(preferences.getAwards() != null && !preferences.getAwards().awardsSet.isEmpty()) {
                    java.util.List<Award> aws = preferences.getAwards().awardsSet;
                    String request = "SELECT * from "+CarShowConstants.Specials+";";
                    rs = getDBData(request);
                    if(rs.length == 0) { // MUST INIT CASE!!!
                        initPrefsAwards(true);
                    }
                    else {
                        Iterator it = aws.iterator();
                        while(it.hasNext()) {
                            Award currAwd = (Award)it.next();
                            if(currAwd.getAwardName().equals("")) {
                                logger.log(Level.WARNING,"initAwards, illegal (empty) award name in preferences");
                            }
                            else {
                                boolean haveAward = false;
                                logger.log(Level.INFO,"initAwards: Award Label found: {0}",currAwd.getAwardName());
                                for(int j = 0; j < rs.length; j++) {
                                    if(rs[j].get("award").equals(currAwd.getAwardName())) {
                                        haveAward = true;
                                        break;
                                    }
                                }
                                if(!haveAward) {
                                    request = "INSERT INTO "+CarShowConstants.Specials+
                                        " (award, entrant_num, canshare) VALUES (\""+
                                        currAwd.getAwardName()+"\", 0, "+
                                        currAwd.getCanShare().intValue()+");";
                                    int ret = execDBUpdate(request);
                                    if(ret <= 0) logger.log(Level.WARNING,"initAwds: Award add failed, stmt: "+request);
                                    else logger.log(Level.INFO,"Added award to DB: "+currAwd.getAwardName());
                                }
                            }
                        }
                    }
                }
                else { // no preferences, init using defaults in CarShowConstants
                    initDefaultAwards(true);
                }
            }
        }
        else { // Slave client, use DB data for local HashMap objects
            if(validServer) {
                String request = "SELECT * from "+CarShowConstants.Specials+";";
                rs = getDBData(request);
                if(rs.length == 0) {
                    logger.log(Level.WARNING,"initDefltAwds: empty awards set on server");
                }
                else // set our view of the awards in our internal tables
                    updateSpecialAwards(rs);
            }
        }
    }
    
    /**
     * This method performs a DB reset of the Specials table and populates
     * it with the values from the Awards list contained therein. 
     * @param newdb true if a new DB Specials table should be created
     */
    void initPrefsAwards(boolean newdb) {
        int exitCode = 0;
        if(!newdb) {// exitCode can be 0, so ignore it for now...
            exitCode = execDBUpdate(CarShowConstants.deleteSpecials);
            if(exitCode < 0) logger.log(Level.WARNING,"SQL error on Specials table delete");
            exitCode = execDBUpdate(CarShowConstants.createSpecials);
            if(exitCode < 0) logger.log(Level.WARNING,"SQL error on Specials table create");
        }
        PreparedStatement prep;
        if(this.preferences != null) {
            if(preferences.getAwards() != null && !preferences.getAwards().awardsSet.isEmpty()) {
                try {            
                    prep = DBconn.prepareStatement(CarShowConstants.awardAddPrepStmt);
                    java.util.List<Award> aws = preferences.getAwards().awardsSet;
                    Iterator it = aws.iterator();
                    int idx = 0;
                    while(it.hasNext()) {
                        Award currAwd = (Award)it.next();
                        if(currAwd.getAwardName() == null || currAwd.getAwardName().equals("")) {
                            logger.log(Level.WARNING,"initPrefAwds, illegal (empty) award name in preferences");
                        }
                        else {
                            logger.log(Level.INFO,"initPrefAwds: Award Label found: {0}",currAwd.getAwardName());
                            prep.setString(1,currAwd.getAwardName());
                            prep.setInt(2,0); // award winner entrant_num
                            if(currAwd.getCanShare() != null) prep.setInt(3,currAwd.getCanShare().intValue());
                            else prep.setInt(3,0);
                            prep.setInt(4,idx); // award order (aorder) form display order
                            prep.setInt(5, 0); // canplace flag, currently unused...
                        }
                        prep.addBatch();
                        idx++;
                    }
                    DBconn.setAutoCommit(false);
                    int[] rets = prep.executeBatch();
                    DBconn.setAutoCommit(true);
                    prep.close();
                    for(int k = 0; k < rets.length; k++) {
                        if(rets[k] != 1) {
                            logger.log(Level.WARNING,"initPrefAwds: exec prep stmt failed for Award element {0}",k);
                        }
                    }
                } catch (SQLException sqle) {
                    logger.log(Level.WARNING,"SQL Exception on Preferences Awards DB init",sqle);
                }
                if(this.SpecialAwards == null) this.SpecialAwards = new HashMap<String,String>();
            }
        }
    }
    /**
     * Initialize the awards DB table using the default values present in
     * the CarShowConstants class.  These are the defaults originally used
     * to support the Rebels Auto Club show, for whom this was originally
     * developed.
     * @param newdb true if the DB should be erased and recreated
     */
    private void initDefaultAwards(boolean newdb) {
        int exitCode = 0;
        if(!newdb) // exitCode can be 0, so ignore it for now...
            exitCode = execDBUpdate(CarShowConstants.deleteSpecials);
        if(exitCode < 0) logger.log(Level.WARNING,"SQL error on Specials table delete");
        exitCode = execDBUpdate(CarShowConstants.createSpecials);
        if(exitCode < 0) logger.log(Level.WARNING,"SQL error on Specials table create");
        PreparedStatement prep;
        try {            
            prep = DBconn.prepareStatement(CarShowConstants.awardAddPrepStmt);
            for(int i = 0; i < CarShowConstants.defaultAwards.length; i++) {
                prep.setString(0,CarShowConstants.defaultAwards[i]);
                        prep.setInt(1,0);
                        prep.setInt(2,CarShowConstants.defaultShares[i]);
                        prep.setInt(3,i); // order of appearance on form award 1-N
            }
            prep.addBatch();
        } catch (SQLException sqle) {
            logger.log(Level.WARNING,"SQLE adding default awards to DB",sqle);
        }
        if(this.SpecialAwards == null) this.SpecialAwards = new HashMap<String,String>();
    }
    
    /**
     * Initialize the JudgingSheet panel award check boxes based on the DB
     * Specials table values.  These should have already been setup using
     * one of the init*Awards() methods on the SQL serving system,
     * otherwise all awards will be disabled
     * (e.g. invisible and not selectable) since this form uses their existence
     * to label and enable the active awards for this show instance.
     */
    private void initAwardBoxes() {
        String request = "SELECT * FROM "+this.DBname+"."+CarShowConstants.Specials+";";
        HashMap[] rs = getDBData(request);
        if(rs != null) {
            if(rs.length > 0) {
                for(int i = 0; i < rs.length; i++) {
                    int ldx = Integer.parseInt((String)rs[i].get("aorder"));
                    JCheckBox cb = this.AwardsBoxes.get(ldx);
                    cb.setText((String)rs[i].get("award"));
                    cb.setName((String)rs[i].get("award")+"Box");
                    cb.setEnabled(true);
                    cb.setVisible(true);
                }
                for(int i = rs.length; i < 16; i++) {
                    JCheckBox cb = this.AwardsBoxes.get(i);
                    cb.setEnabled(false);
                    cb.setVisible(false);
                }
            }
            else {
                logger.log(Level.WARNING,"Specials data in DB is zero length!");
                Iterator it = this.AwardsBoxes.iterator();
                while(it.hasNext()) { // Disable all awards
                    JCheckBox cb = (JCheckBox)it.next();
                    cb.setEnabled(false);
                }
            }
        }
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        RegStatusButtonGroup = new javax.swing.ButtonGroup();
        wrapperPanel = new javax.swing.JPanel();
        tabbedPane = new myJTabbedPane();
        RegistrationPanel = new javax.swing.JPanel();
        EntryNumLabel = new javax.swing.JLabel();
        FirstNameLabel = new javax.swing.JLabel();
        LastNameLabel = new javax.swing.JLabel();
        AddrLabel = new javax.swing.JLabel();
        CityLabel = new javax.swing.JLabel();
        StateLabel = new javax.swing.JLabel();
        ZipLabel = new javax.swing.JLabel();
        MakeLabel = new javax.swing.JLabel();
        ModelLabel = new javax.swing.JLabel();
        YearLabel = new javax.swing.JLabel();
        EntrantNumber = new javax.swing.JTextField();
        FirstName = new javax.swing.JTextField();
        LastName = new javax.swing.JTextField();
        EntrantAddress = new javax.swing.JTextField();
        EntrantState = new javax.swing.JTextField();
        EntrantZipCode = new javax.swing.JTextField();
        EntrantPhone = new javax.swing.JTextField();
        EntrantMake = new javax.swing.JTextField();
        EntrantModel = new javax.swing.JTextField();
        PhoneLabel = new javax.swing.JLabel();
        EntrantYear = new javax.swing.JTextField();
        AddEntrant = new javax.swing.JButton();
        ClassLabel = new javax.swing.JLabel();
        ColorLabel = new javax.swing.JLabel();
        EntrantColor = new javax.swing.JTextField();
        EntrantCity = new javax.swing.JTextField();
        ModelLabel1 = new javax.swing.JLabel();
        EntrantSearch = new javax.swing.JButton();
        EntrantClear = new javax.swing.JButton();
        HostClubName = new javax.swing.JLabel();
        ParkingNumLabel = new javax.swing.JLabel();
        EntrantParking = new javax.swing.JTextField();
        EntrantClub = new javax.swing.JComboBox();
        EntrantClass = new javax.swing.JComboBox();
        regWait = new java.awt.Label();
        RegPrint = new javax.swing.JButton();
        EntrantDeleteButton = new javax.swing.JButton();
        ArchiveSearchButton = new javax.swing.JButton();
        ClassSetPanel = new javax.swing.JPanel();
        ClassMnemonicLabel = new javax.swing.JLabel();
        ClassNameLabel = new javax.swing.JLabel();
        StartYearLabel = new javax.swing.JLabel();
        NewClassMnemonic = new javax.swing.JTextField();
        NewClassName = new javax.swing.JTextField();
        NewClassEndYear = new javax.swing.JTextField();
        EndYearLabel = new javax.swing.JLabel();
        AddClassButton = new javax.swing.JButton();
        NewClassStartYear = new javax.swing.JTextField();
        DeleteClassButton = new javax.swing.JButton();
        ClassWait = new java.awt.Label();
        ClassListPanel = new javax.swing.JScrollPane();
        ClassListTable = new javax.swing.JTable();
        JudgeSheetPanel = new javax.swing.JPanel();
        JudgeSheetSubPanel = new javax.swing.JPanel();
        EntryNumLabel2 = new javax.swing.JLabel();
        MakeLabel1 = new javax.swing.JLabel();
        ModelLabel2 = new javax.swing.JLabel();
        YearLabel1 = new javax.swing.JLabel();
        JS_EntrantNumber = new javax.swing.JTextField();
        JS_EntrantMake = new javax.swing.JTextField();
        JS_EntrantModel = new javax.swing.JTextField();
        JS_EntrantYear = new javax.swing.JTextField();
        ClassLabel1 = new javax.swing.JLabel();
        JS_EntrantClass = new javax.swing.JTextField();
        JSColorLabel = new javax.swing.JLabel();
        JS_EntrantColor = new javax.swing.JTextField();
        JS_ParkingNumLabel = new javax.swing.JLabel();
        JS_ParkingNumber = new javax.swing.JTextField();
        BodyScoreLabel1 = new javax.swing.JLabel();
        JS_BodyScore1 = new javax.swing.JTextField();
        EngineScoreLabel1 = new javax.swing.JLabel();
        JS_InteriorScore1 = new javax.swing.JTextField();
        InteriorScoreLabel1 = new javax.swing.JLabel();
        JS_EngineScore1 = new javax.swing.JTextField();
        ChassisScoreLabel1 = new javax.swing.JLabel();
        JS_ChassisScore1 = new javax.swing.JTextField();
        WheelsScoreLabel1 = new javax.swing.JLabel();
        JS_TireScore1 = new javax.swing.JTextField();
        TiresScoreLabel1 = new javax.swing.JLabel();
        JS_WheelsScore1 = new javax.swing.JTextField();
        BodyMxPtsLabel1 = new javax.swing.JLabel();
        EngineMxPtsLabel1 = new javax.swing.JLabel();
        InteriorMxPtsLabel1 = new javax.swing.JLabel();
        ChassisMxPtsLabel1 = new javax.swing.JLabel();
        TiresMxPtsLabel1 = new javax.swing.JLabel();
        WheelsMxPtsLabel1 = new javax.swing.JLabel();
        JudgeInitialsLabel1 = new javax.swing.JLabel();
        JS_JudgeInitials1 = new javax.swing.JTextField();
        BodyScoreLabel2 = new javax.swing.JLabel();
        JS_BodyScore2 = new javax.swing.JTextField();
        BodyMxPtsLabel2 = new javax.swing.JLabel();
        EngineScoreLabel2 = new javax.swing.JLabel();
        JS_EngineScore2 = new javax.swing.JTextField();
        EngineMxPtsLabel2 = new javax.swing.JLabel();
        InteriorScoreLabel2 = new javax.swing.JLabel();
        JS_InteriorScore2 = new javax.swing.JTextField();
        InteriorMxPtsLabel2 = new javax.swing.JLabel();
        ChassisScoreLabel2 = new javax.swing.JLabel();
        JS_ChassisScore2 = new javax.swing.JTextField();
        ChassisMxPtsLabel2 = new javax.swing.JLabel();
        TiresScoreLabel2 = new javax.swing.JLabel();
        JS_TireScore2 = new javax.swing.JTextField();
        TiresMxPtsLabel2 = new javax.swing.JLabel();
        WheelsScoreLabel2 = new javax.swing.JLabel();
        JS_WheelsScore2 = new javax.swing.JTextField();
        WheelsMxPtsLabel2 = new javax.swing.JLabel();
        JudgeIntialsLabel2 = new javax.swing.JLabel();
        JS_JudgeInitials2 = new javax.swing.JTextField();
        JS_SaveButton = new javax.swing.JButton();
        judgingSheetWait = new java.awt.Label();
        specialtyAwardsLabel = new javax.swing.JLabel();
        Award1Box = new javax.swing.JCheckBox();
        Award2Box = new javax.swing.JCheckBox();
        Award3Box = new javax.swing.JCheckBox();
        Award4Box = new javax.swing.JCheckBox();
        Award5Box = new javax.swing.JCheckBox();
        Award6Box = new javax.swing.JCheckBox();
        Award7Box = new javax.swing.JCheckBox();
        Award8Box = new javax.swing.JCheckBox();
        Award9Box = new javax.swing.JCheckBox();
        Award10Box = new javax.swing.JCheckBox();
        Award11Box = new javax.swing.JCheckBox();
        Award12Box = new javax.swing.JCheckBox();
        Award13Box = new javax.swing.JCheckBox();
        Award14Box = new javax.swing.JCheckBox();
        Award15Box = new javax.swing.JCheckBox();
        Award16Box = new javax.swing.JCheckBox();
        JudgingPanel = new javax.swing.JPanel();
        JudgingPane = new javax.swing.JScrollPane();
        CarScores = new javax.swing.JTable();
        JudgingWait = new java.awt.Label();
        AwardsPanel = new javax.swing.JPanel();
        AwardsPane = new javax.swing.JScrollPane();
        ReportTable = new javax.swing.JTable();
        AwardsPrintButton = new javax.swing.JButton();
        AwardsSaveResultsButton = new javax.swing.JButton();
        AwardsWait = new java.awt.Label();
        MostClubMembers = new javax.swing.JTextField();
        MostClubsLabel = new javax.swing.JLabel();
        SecondMostClub = new javax.swing.JTextField();
        AdminPanel = new javax.swing.JPanel();
        ContestNameLabel = new javax.swing.JLabel();
        ContestName = new javax.swing.JTextField();
        ShowDateLabel = new javax.swing.JLabel();
        ShowLocationLabel = new javax.swing.JLabel();
        ShowDate = new javax.swing.JTextField();
        ShowLocation = new javax.swing.JTextField();
        ServerNameLabel = new javax.swing.JLabel();
        ScoringServerName = new javax.swing.JTextField();
        AdminWait = new java.awt.Label();
        debugButton = new javax.swing.JToggleButton();
        jLabel1 = new javax.swing.JLabel();
        IPAddrLabel = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        ServerUserID = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        ServerPassword = new javax.swing.JTextField();
        ServerSaveButton = new javax.swing.JButton();
        ResetEntrantLabel = new javax.swing.JLabel();
        ResetEntrantDataButton = new javax.swing.JButton();
        ArchiveEntrantLabel = new javax.swing.JLabel();
        ArchiveEntrantDataButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        wrapperPanel.setName("wrapperPanel"); // NOI18N

        tabbedPane.setName("tabbedPane"); // NOI18N
        tabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                tabbedPaneStateChanged(evt);
            }
        });

        RegistrationPanel.setName("RegistrationPanel"); // NOI18N
        RegistrationPanel.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                RegPanelFocusGained(evt);
            }
        });

        EntryNumLabel.setText("Registration Number");

        FirstNameLabel.setText("Name First");

        LastNameLabel.setText("Last");

        AddrLabel.setText("Address");

        CityLabel.setText("City");

        StateLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        StateLabel.setText("State");
        StateLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        ZipLabel.setText("Zip");

        MakeLabel.setText("Car Make");

        ModelLabel.setText("Car Model");

        YearLabel.setText("Year");

        EntrantNumber.setBackground(new java.awt.Color(255, 255, 153));
        EntrantNumber.setName("EntrantNumber"); // NOI18N
        EntrantNumber.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                EntNumMouseClicked(evt);
            }
        });
        EntrantNumber.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                EntrantNumberFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                EntrantNumberFocusLost(evt);
            }
        });

        EntrantState.setColumns(2);
        EntrantState.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        EntrantZipCode.setColumns(6);

        PhoneLabel.setText("Phone");

        AddEntrant.setText("Add Entrant");
        AddEntrant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AddEntrantActionPerformed(evt);
            }
        });

        ClassLabel.setText("Entry Class");

        ColorLabel.setText("Color");

        ModelLabel1.setText("Car Club");

        EntrantSearch.setText("Search Entrant");
        EntrantSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EntrantSearchActionPerformed(evt);
            }
        });

        EntrantClear.setText("Clear ");
        EntrantClear.setName("EntrantClear"); // NOI18N
        EntrantClear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EntrantClearActionPerformed(evt);
            }
        });

        HostClubName.setFont(new java.awt.Font("Copperplate Gothic Light", 1, 36)); // NOI18N
        HostClubName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        HostClubName.setText(HostClub);
        HostClubName.setFocusable(false);

        ParkingNumLabel.setText("Parking Number");

        EntrantParking.setBackground(new java.awt.Color(153, 255, 153));
        EntrantParking.setFocusCycleRoot(true);

        EntrantClub.setEditable(true);
        EntrantClub.setActionCommand("editableComboKeyListener");
        EntrantClub.setName("EntrantClub"); // NOI18N

        EntrantClass.setMaximumRowCount(10);
        EntrantClass.setName("EntrantClass"); // NOI18N
        EntrantClass.setPreferredSize(new java.awt.Dimension(152, 20));

        regWait.setEnabled(false);
        regWait.setName("regWait"); // NOI18N
        regWait.setText("Wait...");

        RegPrint.setText("Print");
        RegPrint.setName("RegPrint"); // NOI18N
        RegPrint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegPrintActionPerformed(evt);
            }
        });

        EntrantDeleteButton.setText("Delete");
        EntrantDeleteButton.setName("EntrantDelete"); // NOI18N
        EntrantDeleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EntrantDeleteActionPerformed(evt);
            }
        });

        ArchiveSearchButton.setText("Search Archive");
        ArchiveSearchButton.setActionCommand("SearchArchive");
        ArchiveSearchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ArchiveSearchActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout RegistrationPanelLayout = new org.jdesktop.layout.GroupLayout(RegistrationPanel);
        RegistrationPanel.setLayout(RegistrationPanelLayout);
        RegistrationPanelLayout.setHorizontalGroup(
            RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(RegistrationPanelLayout.createSequentialGroup()
                .add(64, 64, 64)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(PhoneLabel)
                    .add(AddrLabel)
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(YearLabel)
                        .add(52, 52, 52)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(EntrantYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(EntrantModel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 146, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(21, 21, 21)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(ColorLabel)
                            .add(MakeLabel))
                        .add(18, 18, 18)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(EntrantColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                            .add(EntrantMake)))
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(ModelLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(ClassLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .add(18, 18, 18)
                        .add(EntrantClass, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 310, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(ModelLabel1)
                        .add(18, 18, 18)
                        .add(EntrantClub, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 196, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(RegistrationPanelLayout.createSequentialGroup()
                            .add(CityLabel)
                            .add(284, 284, 284))
                        .add(org.jdesktop.layout.GroupLayout.LEADING, RegistrationPanelLayout.createSequentialGroup()
                            .add(266, 266, 266)
                            .add(regWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(RegistrationPanelLayout.createSequentialGroup()
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(36, 36, 36)
                        .add(EntryNumLabel)
                        .add(4, 4, 4)
                        .add(EntrantNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(486, 486, 486)
                        .add(ParkingNumLabel)
                        .add(4, 4, 4)
                        .add(EntrantParking, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(64, 64, 64)
                        .add(FirstNameLabel)
                        .add(23, 23, 23)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(RegistrationPanelLayout.createSequentialGroup()
                                .add(EntrantCity, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 194, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(18, 18, 18)
                                .add(StateLabel)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(EntrantState, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(18, 18, 18)
                                .add(ZipLabel)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(EntrantZipCode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, RegistrationPanelLayout.createSequentialGroup()
                                    .add(FirstName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 125, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(27, 27, 27)
                                    .add(LastNameLabel)
                                    .add(10, 10, 10)
                                    .add(LastName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 146, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(EntrantAddress))
                            .add(EntrantPhone, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(138, 138, 138)
                        .add(AddEntrant, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(127, 127, 127)
                        .add(EntrantSearch)
                        .add(121, 121, 121)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(EntrantDeleteButton)
                            .add(EntrantClear))
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(RegistrationPanelLayout.createSequentialGroup()
                                .add(44, 44, 44)
                                .add(RegPrint))
                            .add(RegistrationPanelLayout.createSequentialGroup()
                                .add(34, 34, 34)
                                .add(ArchiveSearchButton))))
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .add(HostClubName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 886, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(0, 11, Short.MAX_VALUE))
        );
        RegistrationPanelLayout.setVerticalGroup(
            RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(RegistrationPanelLayout.createSequentialGroup()
                .add(30, 30, 30)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(EntrantNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(EntrantParking, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(3, 3, 3)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(EntryNumLabel)
                            .add(ParkingNumLabel))))
                .add(18, 18, 18)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(FirstName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(LastName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(3, 3, 3)
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(FirstNameLabel)
                            .add(LastNameLabel))))
                .add(6, 6, 6)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(EntrantAddress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(AddrLabel))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(EntrantState)
                        .add(ZipLabel)
                        .add(EntrantZipCode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(StateLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, EntrantCity, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, CityLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(0, 0, Short.MAX_VALUE)))
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(RegistrationPanelLayout.createSequentialGroup()
                        .add(7, 7, 7)
                        .add(EntrantPhone, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, RegistrationPanelLayout.createSequentialGroup()
                        .add(8, 8, 8)
                        .add(PhoneLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(18, 18, 18)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(EntrantMake, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(MakeLabel))
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(EntrantYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(YearLabel)))
                .add(18, 18, 18)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(EntrantModel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(ModelLabel)
                        .add(ColorLabel))
                    .add(EntrantColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(15, 15, 15)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(EntrantClass, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(ClassLabel)
                        .add(EntrantClub)
                        .add(ModelLabel1)))
                .add(18, 18, 18)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(regWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(EntrantDeleteButton)
                        .add(ArchiveSearchButton)))
                .add(20, 20, 20)
                .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(EntrantSearch)
                    .add(RegistrationPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(EntrantClear)
                        .add(RegPrint))
                    .add(AddEntrant))
                .add(18, 18, 18)
                .add(HostClubName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(134, 134, 134))
        );

        HostClubName.getAccessibleContext().setAccessibleName("");
        ((myJTabbedPane)tabbedPane).addMarker(regWait);
        regWait.setVisible(false);
        RegPrint.setVisible(false);

        tabbedPane.addTab("Registration", RegistrationPanel);

        ClassSetPanel.setName("ClassPane"); // NOI18N
        ClassSetPanel.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                ClassSetPanelFocusGained(evt);
            }
        });

        ClassMnemonicLabel.setText("Class");

        ClassNameLabel.setText("Class Name");

        StartYearLabel.setText("Start Year");

        NewClassMnemonic.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                NewClassFocusLost(evt);
            }
        });

        EndYearLabel.setText("End Year");

        AddClassButton.setText("Add Class");
        AddClassButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AddClassButtonActionPerformed(evt);
            }
        });

        DeleteClassButton.setText("Delete Class");
        DeleteClassButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DeleteClassButtonActionPerformed(evt);
            }
        });

        ClassWait.setEnabled(false);
        ClassWait.setName("ClassWait"); // NOI18N
        ClassWait.setText("Wait...");

        ClassListPanel.setPreferredSize(new java.awt.Dimension(454, 508));

        ClassListTable.setModel(ClassTableModel);
        ClassListTable.setMinimumSize(new java.awt.Dimension(60, 240));
        ClassListTable.setName("ClassListTable"); // NOI18N
        ClassListPanel.setViewportView(ClassListTable);

        org.jdesktop.layout.GroupLayout ClassSetPanelLayout = new org.jdesktop.layout.GroupLayout(ClassSetPanel);
        ClassSetPanel.setLayout(ClassSetPanelLayout);
        ClassSetPanelLayout.setHorizontalGroup(
            ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(ClassSetPanelLayout.createSequentialGroup()
                .add(21, 21, 21)
                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(ClassSetPanelLayout.createSequentialGroup()
                        .add(ClassListPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 649, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(ClassSetPanelLayout.createSequentialGroup()
                        .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(ClassMnemonicLabel)
                            .add(ClassNameLabel)
                            .add(EndYearLabel)
                            .add(StartYearLabel))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(ClassSetPanelLayout.createSequentialGroup()
                                .add(AddClassButton)
                                .add(76, 76, 76)
                                .add(DeleteClassButton))
                            .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(NewClassMnemonic, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 71, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(NewClassName)
                                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, NewClassEndYear)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, NewClassStartYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 71, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                        .add(744, 744, 744))))
            .add(ClassSetPanelLayout.createSequentialGroup()
                .add(313, 313, 313)
                .add(ClassWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(0, 0, Short.MAX_VALUE))
        );
        ClassSetPanelLayout.setVerticalGroup(
            ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(ClassSetPanelLayout.createSequentialGroup()
                .add(38, 38, 38)
                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ClassMnemonicLabel)
                    .add(NewClassMnemonic, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(NewClassName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(ClassNameLabel))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(StartYearLabel)
                    .add(NewClassStartYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(EndYearLabel)
                    .add(NewClassEndYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(ClassSetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(AddClassButton)
                    .add(DeleteClassButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(ClassListPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 275, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(ClassWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(90, Short.MAX_VALUE))
        );

        ClassWait.getAccessibleContext().setAccessibleName("ClassWait");
        ((myJTabbedPane)tabbedPane).addMarker(ClassWait);
        ClassWait.setVisible(false);

        tabbedPane.addTab("Class Setup", ClassSetPanel);

        JudgeSheetPanel.setName("JudgeSheetPanel"); // NOI18N

        JudgeSheetSubPanel.setName("JudgeSubPanel"); // NOI18N

        EntryNumLabel2.setText("Registration Number");

        MakeLabel1.setText("Car Make");

        ModelLabel2.setText("Car Model");

        YearLabel1.setText("Year");

        JS_EntrantNumber.setName("JS_EntrantNumber"); // NOI18N
        JS_EntrantNumber.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                JS_RegNumFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                JudgeSheetEntNumberFocusLost(evt);
            }
        });

        ClassLabel1.setText("Entry Class");

        JSColorLabel.setText("Color");

        JS_ParkingNumLabel.setText("Parking Number");

        BodyScoreLabel1.setText("Body Score");

        JS_BodyScore1.setName("j1_cat1"); // NOI18N

        EngineScoreLabel1.setText("Engine Score");

        JS_InteriorScore1.setName("j1_cat3"); // NOI18N

        InteriorScoreLabel1.setText("Chassis Score");

        JS_EngineScore1.setName("j1_cat2"); // NOI18N

        ChassisScoreLabel1.setText("Interior Score");

        JS_ChassisScore1.setName("j1_cat4"); // NOI18N

        WheelsScoreLabel1.setText("Wheels Score");
        WheelsScoreLabel1.setRequestFocusEnabled(false);

        JS_TireScore1.setName("j1_cat5"); // NOI18N

        TiresScoreLabel1.setText("Tires Score");

        JS_WheelsScore1.setName("j1_cat6"); // NOI18N
        JS_WheelsScore1.setPreferredSize(new java.awt.Dimension(55, 30));

        BodyMxPtsLabel1.setText("20 pts Max");

        EngineMxPtsLabel1.setText("20 pts Max");

        InteriorMxPtsLabel1.setText("20 pts Max");

        ChassisMxPtsLabel1.setText("20 pts Max");

        TiresMxPtsLabel1.setText("10 pts Max");

        WheelsMxPtsLabel1.setText("10 pts Max");

        JudgeInitialsLabel1.setText("Judge #1 Initials");

        BodyScoreLabel2.setText("Body Score");

        JS_BodyScore2.setName("j2_cat1"); // NOI18N

        BodyMxPtsLabel2.setText("20 pts Max");

        EngineScoreLabel2.setText("Engine Score");

        JS_EngineScore2.setName("j2_cat2"); // NOI18N

        EngineMxPtsLabel2.setText("20 pts Max");

        InteriorScoreLabel2.setText("Chassis Score");

        JS_InteriorScore2.setName("j2_cat3"); // NOI18N

        InteriorMxPtsLabel2.setText("20 pts Max");

        ChassisScoreLabel2.setText("Interior Score");

        JS_ChassisScore2.setName("j2_cat4"); // NOI18N

        ChassisMxPtsLabel2.setText("20 pts Max");

        TiresScoreLabel2.setText("Tires Score");

        JS_TireScore2.setName("j2_cat5"); // NOI18N

        TiresMxPtsLabel2.setText("10 pts Max");

        WheelsScoreLabel2.setText("Wheels Score");

        JS_WheelsScore2.setName("j2_cat6"); // NOI18N

        WheelsMxPtsLabel2.setText("10 pts Max");

        JudgeIntialsLabel2.setText("Judge #2 Initials");

        JS_JudgeInitials2.setName("j2_cat6"); // NOI18N

        JS_SaveButton.setText("Save");
        JS_SaveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JudgeSheetSaveActionPerformed(evt);
            }
        });

        judgingSheetWait.setEnabled(false);
        judgingSheetWait.setName("judgingSheetWait"); // NOI18N
        judgingSheetWait.setText("Wait...");

        specialtyAwardsLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        specialtyAwardsLabel.setText("Specialty Awards");
        specialtyAwardsLabel.setFocusable(false);
        specialtyAwardsLabel.setName("specialtyAwardsLabel"); // NOI18N
        specialtyAwardsLabel.setRequestFocusEnabled(false);
        specialtyAwardsLabel.setVerifyInputWhenFocusTarget(false);

        Award1Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award1Box.setText("Best Custom Car");
        Award1Box.setName("Award1"); // NOI18N
        Award1Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award2Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award2Box.setText("Best Street Rod");
        Award2Box.setName("Award2"); // NOI18N
        Award2Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award3Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award3Box.setText("Best Truck");
        Award3Box.setName("Award3"); // NOI18N
        Award3Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award4Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award4Box.setText("Best Interior");
        Award4Box.setName("Award4"); // NOI18N
        Award4Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award5Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award5Box.setText("Best Paint");
        Award5Box.setName("Award5"); // NOI18N
        Award5Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award6Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award6Box.setText("Rebels Club Choice");
        Award6Box.setName("Award6"); // NOI18N
        Award6Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award7Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award7Box.setText("Participants Choice");
        Award7Box.setName("Award7"); // NOI18N
        Award7Box.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JSBoxesActionPerformed(evt);
            }
        });

        Award8Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award8Box.setText("Award8");
        Award8Box.setName("Award8"); // NOI18N

        Award9Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award9Box.setText("Award9");
        Award9Box.setName("Award9"); // NOI18N

        Award10Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award10Box.setText("Award10");
        Award10Box.setName("Award10"); // NOI18N

        Award11Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award11Box.setText("Award11");
        Award11Box.setName("Award11"); // NOI18N

        Award12Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award12Box.setText("Award12");
        Award12Box.setName("Award12"); // NOI18N

        Award13Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award13Box.setText("Award13");
        Award13Box.setName("Award13"); // NOI18N

        Award14Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award14Box.setText("Award14");
        Award14Box.setName("Award14"); // NOI18N

        Award15Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award15Box.setText("Award15");
        Award15Box.setName("Award15"); // NOI18N

        Award16Box.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
        Award16Box.setText("Award16");
        Award16Box.setName("Award16"); // NOI18N

        org.jdesktop.layout.GroupLayout JudgeSheetSubPanelLayout = new org.jdesktop.layout.GroupLayout(JudgeSheetSubPanel);
        JudgeSheetSubPanel.setLayout(JudgeSheetSubPanelLayout);
        JudgeSheetSubPanelLayout.setHorizontalGroup(
            JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(EntryNumLabel2)
                                    .add(JS_ParkingNumLabel)
                                    .add(ClassLabel1))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(JS_EntrantNumber, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
                                    .add(JS_ParkingNumber)
                                    .add(JS_EntrantClass))
                                .add(113, 113, 113)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(MakeLabel1)
                                    .add(JSColorLabel))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(JS_EntrantMake, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                                    .add(JS_EntrantColor))
                                .add(62, 62, 62)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(ModelLabel2)
                                    .add(YearLabel1))
                                .add(18, 18, 18)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(JS_EntrantYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(JS_EntrantModel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(300, 300, 300)
                                        .add(JS_SaveButton))
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(33, 33, 33)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(Award1Box)
                                            .add(Award9Box))
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(Award10Box)
                                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                                .add(Award2Box)
                                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                                    .add(Award11Box)
                                                    .add(Award3Box))))
                                        .add(10, 10, 10)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(Award12Box)
                                            .add(Award4Box))))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(Award5Box)
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(1, 1, 1)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(judgingSheetWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                            .add(Award13Box))))
                                .add(18, 18, 18)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(Award6Box)
                                    .add(Award14Box))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(Award7Box)
                                    .add(Award15Box))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(Award16Box)
                                    .add(Award8Box))))
                        .add(0, 50, Short.MAX_VALUE))
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(36, 36, 36)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                .add(specialtyAwardsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(0, 0, Short.MAX_VALUE))
                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, BodyScoreLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, BodyScoreLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, JS_BodyScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(BodyMxPtsLabel2)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, BodyMxPtsLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, JS_BodyScore1))
                                .add(28, 28, 28)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(JS_EngineScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(34, 34, 34))
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                            .add(EngineMxPtsLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 78, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                            .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                                .add(JS_EngineScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .add(EngineScoreLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .add(EngineMxPtsLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 62, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                            .add(EngineScoreLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)))
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(InteriorMxPtsLabel2)
                                    .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                        .add(org.jdesktop.layout.GroupLayout.LEADING, InteriorMxPtsLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE)
                                        .add(org.jdesktop.layout.GroupLayout.LEADING, JS_InteriorScore1))
                                    .add(InteriorScoreLabel2)
                                    .add(JS_InteriorScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(InteriorScoreLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 83, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(18, 18, 18)
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(ChassisScoreLabel2)
                                    .add(ChassisMxPtsLabel2)
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(ChassisScoreLabel1)
                                            .add(JS_ChassisScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                            .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                                .add(org.jdesktop.layout.GroupLayout.LEADING, JS_ChassisScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .add(ChassisMxPtsLabel1)))
                                        .add(27, 27, 27)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                                .add(2, 2, 2)
                                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                                    .add(JS_TireScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                    .add(TiresScoreLabel2)
                                                    .add(TiresMxPtsLabel2)))
                                            .add(TiresScoreLabel1)
                                            .add(JS_TireScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                            .add(TiresMxPtsLabel1))))
                                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(35, 35, 35)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(WheelsScoreLabel2)
                                            .add(WheelsMxPtsLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                                .add(JS_WheelsScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .add(18, 18, 18)
                                                .add(JudgeIntialsLabel2)
                                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                                .add(JS_JudgeInitials2))))
                                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                        .add(37, 37, 37)
                                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(WheelsScoreLabel1)
                                            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                                                .add(JS_WheelsScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                                .add(18, 18, 18)
                                                .add(JudgeInitialsLabel1)
                                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                                .add(JS_JudgeInitials1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                            .add(WheelsMxPtsLabel1))))
                                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
        );
        JudgeSheetSubPanelLayout.setVerticalGroup(
            JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(EntryNumLabel2)
                    .add(JS_EntrantNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(JS_EntrantMake, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(MakeLabel1)
                    .add(ModelLabel2)
                    .add(JS_EntrantModel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JS_ParkingNumLabel)
                    .add(JSColorLabel)
                    .add(JS_EntrantColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(JS_ParkingNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(YearLabel1)
                    .add(JS_EntrantYear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(ClassLabel1)
                            .add(JS_EntrantClass, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(64, 64, 64)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(ChassisScoreLabel1)
                            .add(InteriorScoreLabel1)
                            .add(EngineScoreLabel1)
                            .add(BodyScoreLabel1)
                            .add(TiresScoreLabel1)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, WheelsScoreLabel1))
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(7, 7, 7)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(JS_JudgeInitials1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JudgeInitialsLabel1)))
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(JS_BodyScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JS_EngineScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JS_InteriorScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JS_ChassisScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JS_TireScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JS_WheelsScore1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(BodyMxPtsLabel1)
                            .add(InteriorMxPtsLabel1)
                            .add(EngineMxPtsLabel1)
                            .add(ChassisMxPtsLabel1)
                            .add(TiresMxPtsLabel1)
                            .add(WheelsMxPtsLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .add(94, 94, 94)
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(BodyScoreLabel2)
                            .add(EngineScoreLabel2))
                        .add(8, 8, 8)
                        .add(JS_JudgeInitials2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(InteriorScoreLabel2)
                            .add(ChassisScoreLabel2)
                            .add(TiresScoreLabel2)
                            .add(WheelsScoreLabel2))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                .add(JS_InteriorScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(JS_ChassisScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(JS_TireScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(JS_WheelsScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                .add(JS_EngineScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(JS_BodyScore2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(InteriorMxPtsLabel2)
                            .add(ChassisMxPtsLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(EngineMxPtsLabel2)
                            .add(BodyMxPtsLabel2)
                            .add(TiresMxPtsLabel2)
                            .add(WheelsMxPtsLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(JudgeSheetSubPanelLayout.createSequentialGroup()
                        .add(29, 29, 29)
                        .add(JudgeIntialsLabel2)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(specialtyAwardsLabel)
                .add(4, 4, 4)
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(Award1Box)
                    .add(Award2Box)
                    .add(Award3Box)
                    .add(Award4Box)
                    .add(Award5Box)
                    .add(Award6Box)
                    .add(Award7Box)
                    .add(Award8Box))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(Award10Box)
                        .add(Award9Box)
                        .add(Award12Box)
                        .add(Award13Box)
                        .add(Award14Box)
                        .add(Award15Box)
                        .add(Award16Box))
                    .add(Award11Box))
                .add(16, 16, 16)
                .add(JudgeSheetSubPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JS_SaveButton)
                    .add(judgingSheetWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        judgingSheetWait.getAccessibleContext().setAccessibleName("JudgingSheetWait");
        ((myJTabbedPane)tabbedPane).addMarker(judgingSheetWait);
        judgingSheetWait.setVisible(false);
        Award1Box.getAccessibleContext().setAccessibleName("Award2");
        Award2Box.getAccessibleContext().setAccessibleName("Award2");
        Award3Box.getAccessibleContext().setAccessibleName("Award3");
        Award6Box.getAccessibleContext().setAccessibleName("Award6");
        Award7Box.getAccessibleContext().setAccessibleName("Award7");

        org.jdesktop.layout.GroupLayout JudgeSheetPanelLayout = new org.jdesktop.layout.GroupLayout(JudgeSheetPanel);
        JudgeSheetPanel.setLayout(JudgeSheetPanelLayout);
        JudgeSheetPanelLayout.setHorizontalGroup(
            JudgeSheetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JudgeSheetPanelLayout.createSequentialGroup()
                .add(JudgeSheetSubPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(0, 46, Short.MAX_VALUE))
        );
        JudgeSheetPanelLayout.setVerticalGroup(
            JudgeSheetPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JudgeSheetPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(JudgeSheetSubPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(56, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Judging Sheet", JudgeSheetPanel);

        JudgingPanel.setName("JudgingPanel"); // NOI18N

        CarScores.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "<html>Registration<br/>Number</html>", "Class", "Owner", "Vehicle", "Judge #1", "Score #1", "Judge #2", "Score #2", "Printed"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        CarScores.setFillsViewportHeight(true);
        CarScores.setUpdateSelectionOnSort(false);
        JudgingPane.setViewportView(CarScores);
        if (CarScores.getColumnModel().getColumnCount() > 0) {
            CarScores.getColumnModel().getColumn(0).setResizable(false);
            CarScores.getColumnModel().getColumn(1).setResizable(false);
            CarScores.getColumnModel().getColumn(4).setResizable(false);
            CarScores.getColumnModel().getColumn(5).setResizable(false);
            CarScores.getColumnModel().getColumn(6).setResizable(false);
            CarScores.getColumnModel().getColumn(7).setResizable(false);
        }

        JudgingWait.setEnabled(false);
        JudgingWait.setName("JudgingWait"); // NOI18N
        JudgingWait.setText("Wait...");

        org.jdesktop.layout.GroupLayout JudgingPanelLayout = new org.jdesktop.layout.GroupLayout(JudgingPanel);
        JudgingPanel.setLayout(JudgingPanelLayout);
        JudgingPanelLayout.setHorizontalGroup(
            JudgingPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JudgingPanelLayout.createSequentialGroup()
                .add(JudgingPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JudgingPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .add(JudgingPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 887, Short.MAX_VALUE))
                    .add(JudgingPanelLayout.createSequentialGroup()
                        .add(390, 390, 390)
                        .add(JudgingWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        JudgingPanelLayout.setVerticalGroup(
            JudgingPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JudgingPanelLayout.createSequentialGroup()
                .add(23, 23, 23)
                .add(JudgingPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 515, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JudgingWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        JudgingWait.getAccessibleContext().setAccessibleName("JudgingWait");
        ((myJTabbedPane)tabbedPane).addMarker(JudgingWait);
        JudgingWait.setVisible(false);

        tabbedPane.addTab("Judging", JudgingPanel);

        AwardsPanel.setName("AwardsPanel"); // NOI18N

        ReportTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "<html><div >Reg<br />No.</div></html>", "Class", "Owner", "Year", "Color", "Make", "Model", "Score"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        ReportTable.setName("ReportTable"); // NOI18N
        AwardsPane.setViewportView(ReportTable);

        ReportTable.getColumnModel().getColumn(0).setResizable(false);
        ReportTable.getColumnModel().getColumn(3).setResizable(false);
        ReportTable.getColumnModel().getColumn(7).setResizable(false);
        AwardsPane.setViewportView(ReportTable);
        if (ReportTable.getColumnModel().getColumnCount() > 0) {
            ReportTable.getColumnModel().getColumn(0).setResizable(false);
            ReportTable.getColumnModel().getColumn(3).setResizable(false);
            ReportTable.getColumnModel().getColumn(7).setResizable(false);
        }

        AwardsPrintButton.setText("Print");
        AwardsPrintButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AwardsPrintButtonActionPerformed(evt);
            }
        });

        AwardsSaveResultsButton.setText("Save Results");
        AwardsSaveResultsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AwardsSaveResultsButtonActionPerformed(evt);
            }
        });

        AwardsWait.setEnabled(false);
        AwardsWait.setName("AwardsWait"); // NOI18N
        AwardsWait.setText("Wait...");

        MostClubMembers.setName("MostClubMembers"); // NOI18N

        MostClubsLabel.setText("Most Represented Clubs");

        SecondMostClub.setName("SecondMostClub"); // NOI18N

        org.jdesktop.layout.GroupLayout AwardsPanelLayout = new org.jdesktop.layout.GroupLayout(AwardsPanel);
        AwardsPanel.setLayout(AwardsPanelLayout);
        AwardsPanelLayout.setHorizontalGroup(
            AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(AwardsPanelLayout.createSequentialGroup()
                .add(AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(AwardsPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .add(AwardsPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 846, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(AwardsPanelLayout.createSequentialGroup()
                        .add(44, 44, 44)
                        .add(AwardsSaveResultsButton)
                        .add(70, 70, 70)
                        .add(AwardsPrintButton)
                        .add(54, 54, 54)
                        .add(AwardsWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(26, 26, 26)
                        .add(MostClubsLabel)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(MostClubMembers)
                            .add(SecondMostClub))))
                .addContainerGap(51, Short.MAX_VALUE))
        );
        AwardsPanelLayout.setVerticalGroup(
            AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(AwardsPanelLayout.createSequentialGroup()
                .add(21, 21, 21)
                .add(AwardsPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 391, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(AwardsPrintButton)
                        .add(AwardsSaveResultsButton))
                    .add(AwardsWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(AwardsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(MostClubMembers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(MostClubsLabel)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(SecondMostClub, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(106, Short.MAX_VALUE))
        );

        AwardsWait.getAccessibleContext().setAccessibleName("AwardsWait");
        ((myJTabbedPane)tabbedPane).addMarker(AwardsWait);
        AwardsWait.setVisible(false);

        tabbedPane.addTab("Awards Report", AwardsPanel);

        AdminPanel.setName("AdminPanel"); // NOI18N

        ContestNameLabel.setText("Car Show Contest Name");

        ContestName.setText("Rebels Custom Rod and Stock Classic");

        ShowDateLabel.setText("Car Show Date");

        ShowLocationLabel.setText("Show Location");

        ShowDate.setText("June 24, 2012");

        ShowLocation.setText("Lincoln, Nebraska");

        ServerNameLabel.setText("Scoring Server");

        ScoringServerName.setText(this.SQLServer);
        ScoringServerName.setName("ScoringServerName"); // NOI18N
        ScoringServerName.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ScoringServerNameFocusLost(evt);
            }
        });

        AdminWait.setEnabled(false);
        AdminWait.setName("AdminWait"); // NOI18N
        AdminWait.setText("Wait...");

        debugButton.setText("Debug");
        debugButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                debugButtonActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        jLabel1.setText("Do not press this unless instructed");

        IPAddrLabel.setText("This System IP");

        jLabel2.setText(myIpAddress);

        jButton1.setText("Save");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SaveAdminActionPerformed(evt);
            }
        });

        jLabel3.setText("User ID");

        ServerUserID.setText(ServerUser);

        jLabel4.setText("Password");

        ServerPassword.setText(UserPassword);

        ServerSaveButton.setText("Save");
        ServerSaveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ServerSaveButtonActionPerformed(evt);
            }
        });

        ResetEntrantLabel.setLabelFor(ResetEntrantDataButton);
        ResetEntrantLabel.setText("Reset Entrant Data");
        ResetEntrantLabel.setFocusable(false);
        ResetEntrantLabel.setName("ResetEntrantLabel"); // NOI18N

        ResetEntrantDataButton.setText("Reset");
        ResetEntrantDataButton.setActionCommand("ResetEntrant");
        ResetEntrantDataButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetEntrantData(evt);
            }
        });

        ArchiveEntrantLabel.setLabelFor(ArchiveEntrantDataButton);
        ArchiveEntrantLabel.setText("Archive Entrants");
        ArchiveEntrantLabel.setToolTipText("Save the current show entrants into the archive database for use in next show for auto-populating entrant data");
        ArchiveEntrantLabel.setName("ArchiveEntrantData"); // NOI18N

        ArchiveEntrantDataButton.setText("Archive");
        ArchiveEntrantDataButton.setActionCommand("ArchiveEntrantData");
        ArchiveEntrantDataButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                archiveEntrants(evt);
            }
        });

        org.jdesktop.layout.GroupLayout AdminPanelLayout = new org.jdesktop.layout.GroupLayout(AdminPanel);
        AdminPanel.setLayout(AdminPanelLayout);
        AdminPanelLayout.setHorizontalGroup(
            AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(AdminPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(AdminPanelLayout.createSequentialGroup()
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(AdminPanelLayout.createSequentialGroup()
                                .add(IPAddrLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(85, 85, 85))
                            .add(AdminPanelLayout.createSequentialGroup()
                                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(AdminPanelLayout.createSequentialGroup()
                                        .add(ServerNameLabel)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(ScoringServerName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 228, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(50, 50, 50)
                                        .add(AdminWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(AdminPanelLayout.createSequentialGroup()
                                        .add(30, 30, 30)
                                        .add(ResetEntrantLabel)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(AdminPanelLayout.createSequentialGroup()
                                                .add(debugButton)
                                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                                .add(jLabel1))
                                            .add(AdminPanelLayout.createSequentialGroup()
                                                .add(ResetEntrantDataButton)
                                                .add(18, 18, 18)
                                                .add(ArchiveEntrantLabel)
                                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                                .add(ArchiveEntrantDataButton)))))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 130, Short.MAX_VALUE)))
                        .add(jLabel3)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(ServerUserID, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel4)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(ServerPassword, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(ServerSaveButton))
                        .add(145, 145, 145))
                    .add(AdminPanelLayout.createSequentialGroup()
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(ContestNameLabel)
                            .add(ShowDateLabel)
                            .add(ShowLocationLabel))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jButton1)
                            .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(ContestName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
                                .add(ShowDate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 160, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(ShowLocation)))
                        .add(0, 0, Short.MAX_VALUE))))
        );
        AdminPanelLayout.setVerticalGroup(
            AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(AdminPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ContestNameLabel)
                    .add(ContestName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ShowDateLabel)
                    .add(ShowDate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ShowLocationLabel)
                    .add(ShowLocation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(ServerUserID, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jLabel3)
                        .add(jLabel4)
                        .add(ServerPassword, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, AdminPanelLayout.createSequentialGroup()
                        .add(jButton1)
                        .add(164, 164, 164)
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(ServerNameLabel)
                            .add(ScoringServerName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, AdminWait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(AdminPanelLayout.createSequentialGroup()
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(IPAddrLabel)
                            .add(jLabel2))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(debugButton)
                            .add(jLabel1)))
                    .add(ServerSaveButton))
                .add(26, 26, 26)
                .add(AdminPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ResetEntrantLabel)
                    .add(ResetEntrantDataButton)
                    .add(ArchiveEntrantLabel)
                    .add(ArchiveEntrantDataButton))
                .addContainerGap(152, Short.MAX_VALUE))
        );

        AdminWait.getAccessibleContext().setAccessibleName("AdminWait");
        ((myJTabbedPane)tabbedPane).addMarker(AdminWait);
        AdminWait.setVisible(false);
        ResetEntrantLabel.getAccessibleContext().setAccessibleName("Reset EntrantDataLabel");

        tabbedPane.addTab("Administration", AdminPanel);

        org.jdesktop.layout.GroupLayout wrapperPanelLayout = new org.jdesktop.layout.GroupLayout(wrapperPanel);
        wrapperPanel.setLayout(wrapperPanelLayout);
        wrapperPanelLayout.setHorizontalGroup(
            wrapperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(wrapperPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(tabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 912, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        wrapperPanelLayout.setVerticalGroup(
            wrapperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(wrapperPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(tabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 606, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(wrapperPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(13, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(wrapperPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(0, 27, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    /**
     * Add Registration panel Add Entrant Button action handler.  This
     * validates the Registration form and initiates an add or change depending
     * upon the event (Add Entrant or Change)
     * @param evt event triggering this action performed
     */
    private void AddEntrantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddEntrantActionPerformed
        // Validate inputs for completeness (all entries present except
        // the entrant # which the DB will provide.

        if(evt.getActionCommand().equals("Change")) {
            in_update = true;
        } 
        else {
            in_update = false;
            ThisEntrantPrinted = false;
        }
        
        String currEntNum = null;
        String request = null;
        String clubrequest = null;
        String fname = null;
        String lname = null;
        String addr = null;
        String city = null;
        String state = null;
        String phone = null;
        String zip = null;
        String year = null;
        String make = null;
        String model = null;
        String club = null;
        String color = null;
        String eclass = null;
        String park = null;
        GregorianCalendar gc = new GregorianCalendar();
        int currentYear = gc.get(Calendar.YEAR);
        
        if(FirstName.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "First name is empty. Please enter" +
                " a first name for the entrant.",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            FirstName.requestFocus();
            return;
        }
        else if (LastName.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Last name is empty. Please enter" +
                " a last name for the entrant.",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            LastName.requestFocus();
            return;
        }
        else if (EntrantAddress.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Address is empty. Please enter" +
                " an address for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantAddress.requestFocus();
            return;
        }
        else if (EntrantCity.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "City is empty. Please enter" +
                " a city name for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantCity.requestFocus();
            return;
        }
        else if(EntrantState.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "State is name empty. Please enter" +
                " a state name for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantState.requestFocus();
            return;
        }
        // uncomment if you want Phone # entry required
/*        else if(EntrantPhone.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Phone is empty. Please enter" +
                " a phone number for the entrant or a fictious value if" +
                "entrant does not want to provide their phone number.",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantPhone.requestFocus();
            return;
        } */
        else if(EntrantZipCode.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Zip code is empty. Please enter" +
                " a postal zip code for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantZipCode.requestFocus();
            return;
        }
        else if(EntrantYear.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Car year is empty. Please enter" +
                " the manufacturing year for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantYear.requestFocus();
            return;
        }
        else if(Integer.parseInt(EntrantYear.getText().trim()) < 1886 ||
                Integer.parseInt(EntrantYear.getText().trim()) > currentYear + 1) { // allow for new cars
            JOptionPane.showMessageDialog(tabbedPane,
                "Car year is invalid. Please enter" +
                " a valid (1886 to "+currentYear+") manufacturing year for "+
                "the entrant.", "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantYear.requestFocus();
            return;
        }
        else if(EntrantMake.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Car Make is empty. Please enter" +
                " the manufacturer name for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantMake.requestFocus();
            return;
        }
        else if(EntrantModel.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Car Model is empty. Please enter" +
                " a car model name for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantModel.requestFocus();
            return;
        }
        // uncomment if you want the parking field presence enforced
        /* else if(EntrantParking.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Parking location is empty. Please enter" +
                " a parking location for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantParking.requestFocus();
            return;
        } */
        else if(EntrantColor.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Car Color is empty. Please enter" +
                " a color for the entrant",
                "Invalid Entrant Data", JOptionPane.ERROR_MESSAGE);
            EntrantColor.requestFocus();
            return;
        }
        else {
            // the replaceAll removes any double-quote chars from the strings,
            // Only these will hose us because we use double-quotes to demarcate
            // string boundaries in our SQL statements.
            fname = FirstName.getText().replaceAll("\"","").trim();
            lname = LastName.getText().replaceAll("\"","").trim();
            eclass = ((String) EntrantClass.getSelectedItem());
            if(eclass.equals("")) eclass="PRE"; // default to PRE if not specified
            else eclass = eclass.substring(0,eclass.indexOf(" ")); // trim to first space in class string for mnemonic
            addr = EntrantAddress.getText().replaceAll("\"","").trim();
            city = EntrantCity.getText().replaceAll("\"","").trim();
            state = EntrantState.getText().replaceAll("\"","").trim();
            zip = EntrantZipCode.getText().replaceAll("\"","").trim();
            phone = EntrantPhone.getText().replaceAll("\"","").trim();
            make = EntrantMake.getText().replaceAll("\"","").trim();
            model = EntrantModel.getText().replaceAll("\"","").trim();
            color = EntrantColor.getText().replaceAll("\"","").trim();
            year = EntrantYear.getText().replaceAll("\"","").trim();
            park = EntrantParking.getText().replaceAll("\"","").trim();
            currEntNum = EntrantNumber.getText().replaceAll("\"","").trim();
        }
        if(!EntrantClub.getSelectedItem().equals("")) {
            // if the entrant club is not empty we need to eval if it is a
            // new club (to add to Clubs table) or an existing club which we
            // just store in the Entrants table.
            String tblc;
            if(winHost) tblc = CarShowConstants.winClubs;
            else tblc = CarShowConstants.Clubs;
            club = ((String) EntrantClub.getSelectedItem()).trim();
            if(!checkClub(club)) {
                clubrequest = "insert into "+tblc+" (club) values (\""+ club + "\");";
            }
        }
        else {
            club = ""; // put an empty club string into Entrants table
        }
        String tble;
        String tbls;
        if(winHost) { 
            tble = CarShowConstants.winEntrants;
            tbls = CarShowConstants.winScoring;
        }
        else { 
            tble = CarShowConstants.Entrants;
            tbls = CarShowConstants.Scoring;
        }
        int ppreg = 0;
        // determine if this is a new entrant or an entrant change
        if(in_update) { // Change button is active on Registration panel
            request = "update "+ tble +
                " set fname = \""+fname+"\", lname = \""+lname+"\", mnemonic = \""
                +eclass+"\", address = \""+addr+"\", city = \""+city+"\","
                +" state = \""+state+"\", zip = \""+zip+"\", phone = \""
                +phone+"\", make = \""+make+"\", model = \""
                +model+"\", color = \""+color+"\", year = "+
                year+", parking_loc = \""+park+"\", club = \""+club+"\", preg = "+ppreg+
                " where entrant_num = "+currEntNum;
        }
        else { // Add button is active on Registration panel
            request = "insert into " + tble +
                " (entrant_num, fname,lname,mnemonic,address,city,state,zip," +
                "phone,make,model, color, year, parking_loc, club, preg )" +
                " values ( 0, \"" + fname + "\" ,\"" + lname + "\", \"" + eclass +
                "\", \"" + addr + "\", \"" + city + "\", \"" + state + "\", \"" +
                zip + "\", \"" + phone + "\", \"" + make + "\", \"" + model +
                "\", \"" + color + "\", " + year + ", \"" + park + "\", \"" + club +
                "\", " + ppreg + " );";
        }
        regWait.setEnabled(true);
        regWait.setVisible(true); // set waiting condition for sqlPut()
        //((myJTabbedPane)tabbedPane).setActiveComponent(RegistrationPanel);
        //int ret = sqlPut(RegistrationPanel, request);
        int ret = execDBUpdate(request);
        if(!in_update && ret > 0) {
            request="select entrant_num from "+tble+" where fname=\""+fname+"\" and"+
                " lname=\""+lname+"\" and address=\""+addr+"\" and city=\""+
                city+"\" and state=\""+state+"\" and zip=\""+zip+"\" "+
                    " and make=\""+make+"\" and model=\""+model+"\""+" and year="+year+";";                    
            HashMap[] rs = getDBData(request);
            String entret = "-1";
            if(rs != null && rs.length > 0) {
                entret=(String)rs[0].get("entrant_num");
            }
            EntrantNumber.setText(entret);
        }
        // previously the return code was meaningless,
        // now it contains the entrant number of the newly added entrant!
        if(evt.getActionCommand().equals("Add Entrant")) {
            String scoreInit = "insert into "+tbls+
                " (entrant_num, Judge1, Judge2, j1_total, j2_total) values ("+
                EntrantNumber.getText()+", \"\", \"\", 0, 0);";
            ret = execDBUpdate(scoreInit);
            //ret = sqlPut(scoreInit);
            AddEntrant.setText("Change");
        }
        //waitForIt(regWait);
        
        if(debug) logger.log(Level.INFO,"AddEntActionPerf: post RegWait loop");
        if(debug) logger.log(Level.INFO,"performing club request, clientSocket state is");
        if(clubrequest != null) {
            //EntrantClub.requestFocus();
            regWait.setEnabled(true);
            regWait.setVisible(true);
            if(debug) logger.log(Level.INFO,"AddEntActionPerf: insert club into Clubs");
            //((myJTabbedPane)tabbedPane).setActiveComponent(EntrantClub);
            ret = execDBUpdate(clubrequest);
            //ret = sqlPut(EntrantClub, clubrequest);
            
            //waitForIt(regWait);
        }
    // Here is the auto-printing capability.  Per DTO & customer, the
    // algorithm is as follows:
    // if parking-number != empty (isset) & !printed already
    // & class != PRE
    if(!EntrantParking.getText().equals("")) {
        if(!((String)EntrantClass.getSelectedItem()).substring
                (0,((String)EntrantClass.getSelectedItem()).indexOf(" ")).equals("PRE")
                & !ThisEntrantPrinted) {
            if(((String)EntrantClass.getSelectedItem()).substring
                (0,((String)EntrantClass.getSelectedItem()).indexOf(" ")).toUpperCase().contains("MC")) {
                printScoringSheets(1);
            }
            else
                printScoringSheets(0);
        }
    }
    else EntrantParking.requestFocus();
    //FirstName.requestFocus();
    if(!EntrantNumber.getText().equals("")) {
        if(debug) logger.log(Level.INFO,"AddEntActPerf: set RegPrint On");
        RegPrint.setVisible(true);
        EntrantClub.setSelectedItem(club);
    }
    else {
        logger.log(Level.INFO,"AddEntActPerf: firing search on no ent# ret");
        ActionEvent ae = new ActionEvent(EntrantSearch, ActionEvent.ACTION_PERFORMED,"Search Entrant");
        java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae);
        //EntrantSearchActionPerformed(ae);
    }
    regWait.setEnabled(false);
    regWait.setVisible(false);
    repaint();
}//GEN-LAST:event_AddEntrantActionPerformed

    /**
     * check if the supplied club is already known in the CarShowUI
     * field containing the list of known Clubs which is populated in
     * the last call of setRegClubs().
     * @param clubname
     * @return
     */
    private boolean checkClub(String clubname) {
        boolean foundClub=false;
        if(activeClubs == null) {
            foundClub = false;
        }
        else if(activeClubs.length > 0) {
            for (int i = 0; i < activeClubs.length; i++) {
                if (activeClubs[i] != null && activeClubs[i].equals(clubname))
                    foundClub=true;
            }
        }
        return foundClub;
    }


    private void EntrantSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EntrantSearchActionPerformed
        // Entrant number search by button press instead of tab-out of field
        // check first for EntrantNumber primary key supplied in search
        if(debug) logger.log(Level.INFO,"EntSearchActPerf: entry, evt: {0}",
                evt.getActionCommand());
        String tbl;
        if(winHost) tbl = CarShowConstants.winEntrants;
        else tbl = CarShowConstants.Entrants;
        if (!EntrantNumber.getText().equals("") && !focusSearch) {
            int entNum = new Integer(EntrantNumber.getText()).intValue();
            if(entNum > 0) {
                if(debug) logger.log(Level.INFO,"EntSearchActPerf: get by id: {0} path used...",entNum);
                regWait.setVisible(true);
                String request = "select * from "+tbl+
                    " where entrant_num="+entNum+";";
                HashMap[] rs = getDBData(request);
                if(rs.length > 0) setEntrant(rs);
                regWait.setVisible(false);
                //sqlGet(RegistrationPanel, request);
                //waitForIt(regWait);
            }
            else clearEntrant();
        } // Try using first/last name for search if supplied
/*        else if (!focusSearch && ! LastName.getText().equals("") | ! FirstName.getText().equals("")) {
            regWait.setEnabled(true);
            regWait.setVisible(true);
            String fn = null;
            String ln = null;
            if(FirstName.getText().equals(""))
                fn=FirstName.getText().trim();
            if(LastName.getText().equals(""))
                ln=LastName.getText().trim();
            StringBuilder request = new StringBuilder();
            request.append("select * from "+tbl+" where ");
            if(fn != null) request.append("fname like \"%"+fn+"%\" ");
            if(fn != null && ln != null) request.append(" and ");
            if(ln != null) request.append(" lname like \"%"+ln+"%\"");
            //String request = "select * from "+tbl+
            //    " where fname like\"%"+FirstName.getText().trim()+
            //    "%\" and lname like \"%"+LastName.getText().trim()+"%\";";
            HashMap[] rs = getDBData(request.toString());
            setEntrant(rs);
        } // if !entrantNumber nor first/last name, search on other data */
        else if(!focusSearch) {
            StringBuilder sb = new StringBuilder();
            sb.append("select * from "+tbl+" where ");
            java.util.Set<String> keyset = EntrantFields.keySet();
            Iterator kiter = keyset.iterator();
            boolean noAnd = true;
            boolean conditions = false;
            while(kiter.hasNext()) {
                String currKey = (String)kiter.next();
                javax.swing.JComponent c = EntrantFields.get(currKey);
                if(c instanceof javax.swing.JComboBox) {
                    String val = (String)((javax.swing.JComboBox)c).getSelectedItem();
                    if(val != null && !val.equals("")) {
                        conditions = true;
                        if(!noAnd) sb.append(" and ");
                        if(currKey.equals("mnemonic"))
                            sb.append(currKey+"=\""+val.substring(0,val.indexOf(" "))+"\" ");
                        else sb.append(currKey+" like \"%"+val.trim()+"%\"");
                        noAnd = false;
                    }
                }
                else { // JTextField instance
                    String val = ((javax.swing.JTextField)c).getText();
                    if(val != null && !val.equals("")) {
                        conditions = true;
                        if(!noAnd) sb.append(" and "); //query.append("lower(fname) like lower(\""+fname+"%\")");
                        sb.append("lower("+currKey+") like lower(\"%"+val+"%\") ");
                        noAnd = false;
                    }
                }
            }
            if(conditions) { // ensure we have a valid SQL stmt with where clause(s)
                sb.append(";");
                regWait.setEnabled(true);
                regWait.setVisible(true);
                if(debug) { logger.log(Level.INFO,"entSearchActPerf: "+
                        "!focusSearch request: {0}",sb.toString()); }
                HashMap[] rs = getDBData(sb.toString());
                if(rs.length > 0) setEntrant(rs);
                regWait.setEnabled(false);
                regWait.setVisible(false);
                //sqlGet(RegistrationPanel, sb.toString());
                //waitForIt(regWait);
            }
            else { // if we didnt find any search conditions do this...
                if(debug) logger.log(Level.INFO,"entrantSearch: sql query "+
                        "without conditions: {0}",sb.toString());
                clearEntrant();
            }
        }
        focusSearch = false;
        // This should have already been done in the setEntrant() code
        //if(!EntrantNumber.getText().equals("")) {
        //    if(debug) logger.log(Level.INFO,"EntSearchActPerf: set RegPrint On");
        //    RegPrint.setVisible(true);
        //    FirstName.requestFocus();
        //}
        //else { 
        //    RegPrint.setVisible(false);
        //    EntrantParking.requestFocus();
        //}
    }//GEN-LAST:event_EntrantSearchActionPerformed

    private void EntrantClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EntrantClearActionPerformed
        clearEntrant();
        if(activeClubs != null && activeClubs.length > 0) {
            if(EntrantClub.getItemCount() != activeClubs.length) {
                // this sets 'larger' to the larger of the two values, its
                // a weird syntax of Java that makes this decide & set really
                // compact code but hard to understand for non-Java pros
                if (EntrantClub.getItemCount() < activeClubs.length) {
                    for(int i = 0; i < activeClubs.length; i++) {
                        if(!EntrantClub.getItemAt(i).equals(activeClubs[i]))
                            EntrantClub.addItem(activeClubs[i]);
                    }
                }
            }
        }
        AddEntrant.setText("Add Entrant");
        RegPrint.setVisible(false);
        RegPrint.setBackground(oldPrintColor);
        // Depending upon how you want this to work, I think for usability the
        // First Name field should be selected since the primary task is new
        // entrant addition or search by name. Change this back to my original
        // design/paradigm by swapping the following two lines - wdm
        //EntrantParking.requestFocus();
        FirstName.requestFocus();
    }//GEN-LAST:event_EntrantClearActionPerformed

    private void AddClassButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddClassButtonActionPerformed
        if(debug) logger.log(Level.INFO,"AddClassActionPerformed fired...");
        int currYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR);
        if(NewClassMnemonic.getText().equals("")) {
                JOptionPane.showMessageDialog(tabbedPane,
                "New class label is empty. Please enter" +
                " a class label for the new or changing class.",
                "Class Data", JOptionPane.ERROR_MESSAGE);
                NewClassMnemonic.requestFocus();
                return;
        }
        else if ( NewClassName.getText().equals("")) {
                 JOptionPane.showMessageDialog(tabbedPane,
                "New class name is empty. Please enter" +
                " a name describing the class limitations or inclusions.",
                "Class Data", JOptionPane.ERROR_MESSAGE);
                 NewClassName.requestFocus();
                 return;
        }
            
        else if (NewClassStartYear.getText().equals("") || !checkNum(NewClassStartYear.getText())) {
                JOptionPane.showMessageDialog(tabbedPane,
                "Starting year of class is not a number. Please enter" +
                " a starting year for the class.",
                "Class Data", JOptionPane.ERROR_MESSAGE);
                NewClassStartYear.requestFocus();
                return;
        } 
        
        else if ( NewClassEndYear.getText().equals("") || !checkNum(NewClassEndYear.getText())) {
                JOptionPane.showMessageDialog(tabbedPane,
                "Ending year for the class is empty. Please enter" +
                " an ending year for the class.",
                "Class Data", JOptionPane.ERROR_MESSAGE);
                NewClassEndYear.requestFocus();
                return;
        }
        else if (Integer.parseInt(NewClassStartYear.getText()) < 1885) {
                JOptionPane.showMessageDialog(tabbedPane,
                    "Class starting year is before 1885," +
                    " which is the year Karl Benz built the first automobile." +
                    "Please enter a valid production year range for the new class.",
                    "Class Data", JOptionPane.ERROR_MESSAGE);
                NewClassStartYear.requestFocus();
                return;
        }
        else if (Integer.parseInt(NewClassEndYear.getText()) > currYear) {
                    JOptionPane.showMessageDialog(tabbedPane,
                      "Class ending year is in the future. Please enter a" +
                      " valid production year range for the new class.",
                      "Class Data", JOptionPane.ERROR_MESSAGE);
                    NewClassEndYear.requestFocus();
                    return;
        }
        if(!(activeClasses == null)) {
            for (int i = 0; i < activeClasses.length; i++) {
                // audit the classes and see if there is a preexisting class
                // of this name.  This is unnecessary given we check this on
                // focusLost events for this field, however...
                if(activeClasses[i].equals(NewClassMnemonic.getText())) {
                    JOptionPane.showMessageDialog(tabbedPane,
                      "Class label is already in use. Please choose a" +
                      " different label for this new class.",
                      "Class Data", JOptionPane.ERROR_MESSAGE);
                    NewClassMnemonic.requestFocus();
                    return;
                }
            }
            String[] nact = new String[activeClasses.length+1];
            System.arraycopy(activeClasses,0,nact,0,activeClasses.length);
            activeClasses = nact;
            activeClasses[activeClasses.length-1] = NewClassMnemonic.getText().
                replaceAll(",",".").replaceAll("\"","").trim();
        }
        else {
            activeClasses = new String[1];
            String[] nact = new String[activeClasses.length+1];
            System.arraycopy(activeClasses, 0, nact, 0, activeClasses.length);
            activeClasses[0] = NewClassMnemonic.getText().replaceAll(",",".").
                replaceAll("\"","").trim();
        }
        String tbl;
        if(winHost) tbl = CarShowConstants.winJudgeClasses;
        else tbl = CarShowConstants.JudgeClasses;
        String request = "insert into "+tbl+
            "(mnemonic, classname, StartYear, EndYear) values (\""+
            NewClassMnemonic.getText().replaceAll(",",".").replaceAll("\"","").trim()+"\",\""+
            NewClassName.getText().replaceAll(",",".").replaceAll("\"","").trim()+
            "\","+Integer.parseInt(NewClassStartYear.getText())+","+
            Integer.parseInt(NewClassEndYear.getText())+");";
        if(debug) logger.log(Level.INFO,"ClassAddActPerf: sql request: {0}",request);

        ClassWait.setEnabled(true);
        ClassWait.setVisible(true);
        int ret = execDBUpdate(request);
        //int ret = sqlPut(ClassListTable, request);
        //waitForIt(ClassWait);
        initClassTable();
        NewClassMnemonic.requestFocus();
    }//GEN-LAST:event_AddClassButtonActionPerformed

    private void DeleteClassButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteClassButtonActionPerformed
        if(ClassListTable.getSelectedRow() < 0) {
            if(debug) logger.log(Level.INFO,"DeleteClassBtnActPerf: no row selected in tbl!");
        }
        else {
            int drow = ClassListTable.getSelectedRow();
            Object cclass = ClassListTable.getValueAt(drow,0);
            if(cclass.equals("")) {
                ((javax.swing.table.DefaultTableModel)ClassListTable.getModel()).removeRow(drow);
                ClassListTable.clearSelection();
                return;
            }
            // this is an early-out if they try to delete the PRE class...
            if(((String)cclass).equals("PRE")) {
                JOptionPane.showMessageDialog(tabbedPane,
                    "The PRE class is used internally to mark the registrations\n" +
                    " that have not completed all registration tasks.\n"+
                    "You are _not_ allowed to delete this class.",
                    "Class Data", JOptionPane.ERROR_MESSAGE);
                NewClassMnemonic.requestFocus();
                ClassListTable.clearSelection();
                return;
            }
            String tbl;
            if(winHost) tbl = CarShowConstants.winJudgeClasses;
            else tbl = CarShowConstants.JudgeClasses;
            String request = "delete from "+tbl+
                " where mnemonic = \""+(String)cclass+ //"\" and classname=\""+
                "\"";
            ClassWait.setEnabled(true);
            ClassWait.setVisible(true);
            int ret = execDBUpdate(request);
            //sqlPut(ClassListTable, request);
            //waitForIt(ClassWait);
            initClassTable();
        }
        NewClassMnemonic.requestFocus();
    }//GEN-LAST:event_DeleteClassButtonActionPerformed

    /**
     * Print the Awards Report panel.  This should probably be re-factored into
     * a separate method or class.  Until then, the gory details of printing
     * the awards report is performed here.
     * @param evt print button event
     */
    private void AwardsPrintButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AwardsPrintButtonActionPerformed
        //
        // Prompt for the size of the awards table to print
        // available options: top 3, 5, 7, or All (default)
        //
        JComboBox reportChoice = new JComboBox();
        reportChoice.setModel(new javax.swing.DefaultComboBoxModel(new String[] 
            { "All in each Class", 
            "Top 3 in each Class", 
            "Top 5 in each Class", 
            "Top 7 in each Class" })
        );

        final JComponent[] inputs = new JComponent[] {
		new JLabel("Select Report Detail"),
		reportChoice,
        };
        int rval = JOptionPane.showConfirmDialog(null, inputs, "Report Selection", JOptionPane.CANCEL_OPTION, JOptionPane.OK_OPTION);        
        if(rval == JOptionPane.CANCEL_OPTION ||
                rval == JOptionPane.CLOSED_OPTION)
            return; // if the box is closed by the corner X or Cancel btn
        
        java.awt.Font bbfont = new java.awt.Font("Roman", java.awt.Font.BOLD, 16);
        java.awt.Font nfont = new java.awt.Font("Roman", java.awt.Font.PLAIN, 12);
        java.awt.Font bfont = new java.awt.Font("Roman", java.awt.Font.BOLD, 14);
        String HBold = "<HTML><B>";
        String HSlash = "</B></HTML>";
//        java.awt.Font sbfont = new java.awt.Font("Roman", java.awt.Font.BOLD, 8);
        
        // 0 = All, 1 = Top 3 , 2 = Top 5, 3 = Top 7
        // 2 * SelectedIndex + 1 = desired value 3,5, or 7
        int which = reportChoice.getSelectedIndex(); // get index of selected report
        int significance = 2*which + 1;
        // Create a JFrame that we will pass to the Printer class later
        //new javax.swing.table.DefaultTableModel(
/*        AttributiveCellTableModel actm = new AttributiveCellTableModel(
            new Object [][] {},
            new String [] {
                "Award", "Owner", "Color", "Year", "Make", "Model", "Score"
            }
            ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            //public Class getColumnClass(int columnIndex) {
            //    return types [columnIndex];
            //}

            //public boolean isCellEditable(int rowIndex, int columnIndex) {
            //    return canEdit [columnIndex];
            //}
        }; */
        //AttributiveCellTableModel ml = new AttributiveCellTableModel(ReportTable.getRowCount()+2,7);
//        final CellSpan cellAtt =(CellSpan)actm.getCellAttribute();
//        final MultiSpanCellTable spanTable = new MultiSpanCellTable( actm );
//        JScrollPane spanScroll = new JScrollPane( spanTable );
//        System.out.println("Debug: print table has "+spanTable.getColumnCount()+" cols");
//        System.out.println("Debug: print table has "+spanTable.getRowCount()+" rows");
        JFrame jprintFrame = new JFrame();
        // SET THE CURSOR TO A WAIT OBJECT UNTIL THE PRINT JOB CREATE DONE
        jprintFrame.setCursor(Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
        jprintFrame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
        int prow = 1; // account for top JLabel at init of this row counter
        JTable printTable = buildPrintTable();
        JPanel printFrame = new JPanel();
        //JScrollPane jsp = new JScrollPane(printFrame);
        JScrollPane jsp = new JScrollPane(printTable);
        //jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        // This setPreferredSize(width,height) needs to be dynamic to the size
        // of prow, when everything is finished, thus comment it out
        //printFrame.setPreferredSize(new Dimension(1000,1600));
        printFrame.setLayout(new BoxLayout(printFrame, BoxLayout.PAGE_AXIS));
        JLabel scoreHeader = new javax.swing.JLabel();
        scoreHeader.setText(ContestName.getText()+"        "+ShowDate.getText());
        scoreHeader.setFont(bfont);
        printFrame.add(scoreHeader, -1); // adds to the end, but this is first added
        java.text.MessageFormat header = new java.text.MessageFormat(scoreHeader.getText());
        java.text.MessageFormat footer = new java.text.MessageFormat("Page: {0}");
// make a header on this spannable column output table
//        int[] r = {0};
//        int[] w = {0,1,2,3,4,5,6};
//        String s = ContestName.getText()+"         Hosted By  "+
//                this.HostClub+"             "+ShowDate.getText();
//        Object[] t = new Object[] {s};
//        actm.addRow(t);
//        System.out.println("# rows in spantable: "+spanTable.getRowCount());
        // May be want to reuse the JLabel instead of make a string here?
//        spanTable.setValueAt(ContestName.getText()+"         Hosted By  "+
//                this.HostClub+"             "+ShowDate.getText(),0,0);
//        cellAtt.combine(r,w); // this makes the span all cols line 0&1
//        Object[] o1 = new Object[1]; 
//        actm.addRow(o1); // add a skip line
        String currClass = "";
        int sigCount = 0;
        int trow = 0;
        boolean spaced = false;
        boolean awardState = false; // indicates scanning/printing awards state
        /*
         * For each line in the ReportTable (Awards Report data display)
         * insert any blank lines to separate classes
         * when a class change is detected, close the currently open JTable
         * and put the class name in a JLabel and put it into the output
         * JFrame, printFrame
         */
        //java.awt.print.Book pBook = new java.awt.print.Book();
        PrinterJob pjob = PrinterJob.getPrinterJob();
        java.awt.print.PageFormat preformat = pjob.defaultPage();
        preformat.setOrientation(java.awt.print.PageFormat.LANDSCAPE);
        JTable currentTable = buildScoreTable();
        for(int i = 0; i < ReportTable.getRowCount(); i++) {
            // init the currClass with the first row
            if(currClass.isEmpty()) { 
                currClass = (String)ReportTable.getValueAt(i,1);
                JLabel classLabel = new JLabel(currClass);
                classLabel.setPreferredSize(new Dimension( currClass.length()*10, 24));
                classLabel.setFont(bfont);
                printFrame.add(classLabel, -1);
                //pBook.append(new Printer(classLabel), preformat);
                
                String[] v = new String[] {"",HBold+classLabel.getText()+HSlash};
                ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(v);
//                int[] r1 = {prow};
//                if(actm.getRowCount() <= prow) actm.addRow(o1);
//                cellAtt.combine(r1,w);
//                spanTable.setValueAt(currClass, prow, 0);
                prow++;
            }
            javax.swing.table.DefaultTableModel pfScoreTblModel = 
                (javax.swing.table.DefaultTableModel)currentTable.getModel();

            // handle empty data rows first, SEPARATE DISPLAYED CLASSES HERE
            if((((String)ReportTable.getValueAt(i,0) == null) || ((String)ReportTable.getValueAt(i,0)).isEmpty()) && (ReportTable.getValueAt(i,1) == null || ((String)ReportTable.getValueAt(i,1)).isEmpty())) {
                // Empty row in table, reflect in printed report table
                Object[] o = new Object[1];
                if(!spaced) // this keeps the # of blank rows to 1 btwn classes
                {                            
                    if(pfScoreTblModel.getRowCount() > trow) {
                        pfScoreTblModel.removeRow(i);
                        pfScoreTblModel.insertRow(i,o);
                    }
                    else { 
                        pfScoreTblModel.addRow(o);
                        ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(o);
                    }
//                    if(actm.getRowCount() <= prow) actm.addRow(o);
//                    else {
//                        actm.removeRow(prow);
//                        actm.insertRow(prow, o);
//                    }
                    spaced = true;
                    prow++; // count spaced rows
                    trow++;
                }
                continue;
            }
            else if ((((String)ReportTable.getValueAt(i,0)).equals("Award") &&
                    ((String)ReportTable.getValueAt(i+1,0)).equals("Winners"))) {// ||
                    //!((String)ReportTable.getValueAt(i,0)).matches("[0-9]+")) {
                //Handle end of Scoring/beginning of Awards transition here
                // Add this to printFrame, start an Awards collection JTable
                // making currentTable an AwardTable model JTable, set the
                // state flag awardState
                //System.out.println("Debug ReportTable["+i+",0]="+ReportTable.getValueAt(i,0));
                //System.out.println("Debug ReportTable["+i+"+1,0]="+ReportTable.getValueAt(i+1,0));

                printFrame.add(currentTable, -1);
                String[] v = new String[printTable.getColumnCount()];
                v[1] = "     ";
                ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(v);
                //pBook.append(new Printer(currentTable), preformat);
                JLabel awardsLabel = new JLabel("Awards");
                awardsLabel.setFont(bfont);
                awardsLabel.setPreferredSize(new Dimension(60, 24));
                printFrame.add(awardsLabel, -1); // Label the Awards in the output
                //pBook.append(new Printer(awardsLabel), preformat);
                String[] vals = new String[currentTable.getColumnCount()];
                vals[1] = HBold+"Special Awards"+HSlash;
                ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(vals);
                //TableCellRenderer cellRenderer = printTable.getCellRenderer(prow+2, 1);
                //cellRenderer.getTableCellRendererComponent(printTable, vals, spaced, spaced, trow, i);
                currentTable = buildAwardTable();
                awardState = true;
                trow = 0;
//                int[] r1 = {prow};
//                if(spanTable.getRowCount() <= prow) actm.addRow(o1);
//                cellAtt.combine(r1,w);
//                spanTable.setValueAt("Awards", prow, 0);
                prow += 2; // count the label, currTable was already counted
                i++;  // absorb both Award and the Winners line also
                continue;
            }
            // On change of Class detected, save currentTable to printFrame
            // create a new currentTable for the new set of winners in this
            // new class, make and attach a new jLabel to the printFrame
            // to introduce this next class
            // Class change only matters when not in Awards state
            if(!awardState && !currClass.equals(ReportTable.getValueAt(i,1))) {
                sigCount = 0;
                currClass = (String)ReportTable.getValueAt(i,1);
                printFrame.add(currentTable, -1);
                //pBook.append(new Printer(currentTable), preformat);
                String[] v = new String[printTable.getColumnCount()];
                v[1] = "     ";
                ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(v);
                currentTable = buildScoreTable();
                pfScoreTblModel = 
                (javax.swing.table.DefaultTableModel)currentTable.getModel();
                trow = 0;
                JLabel classLabel = new JLabel(currClass);
                classLabel.setFont(bfont);
                printFrame.add(classLabel, -1);
                String[] v1 = new String[printTable.getColumnCount()];
                v1[1] = HBold+classLabel.getText()+HSlash;
                ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(v1);
//pBook.append(new Printer(classLabel), preformat);
//                int[] r1 = {prow};
//                if(spanTable.getRowCount() <= prow) actm.addRow(o1); // add a dummy row
//                cellAtt.combine(r1,w); // modify the row
//                spanTable.setValueAt(currClass, prow, 0);
                prow++;
            }
            // Enforce chosen display count per class here
            // if which == 0, means 'all' selected so never continue
            // Skip all within the current class with this next line
            if(!awardState && which > 0 && sigCount >= significance) continue;
            // Below, the row in this class is significant/displayable
            sigCount++;
            //String[] vals = new String[ReportTable.getColumnCount()];
            // Make an array to contain the values on the printed table
            String[] vals = new String[currentTable.getColumnCount()];
            // populate table contents according to state, if not in
            // awardsState, add a scoring table entry
            if(!awardState) {
                // Scoring Table
                // "Rank", "Owner", "Color", "Year", "Make", "Model", "Score"
                vals[0] = Integer.toString(sigCount);          // rank
                vals[1] = (String)ReportTable.getValueAt(i,2); // owner
                vals[2] = (String)ReportTable.getValueAt(i,4); // color
                vals[3] = (String)ReportTable.getValueAt(i,3); // year
                vals[4] = (String)ReportTable.getValueAt(i,5); // make
                vals[5] = (String)ReportTable.getValueAt(i,6); // model
                vals[6] = (String)ReportTable.getValueAt(i,7); // score
            }
            else { // Awards Report Table object
                //"Award", "Owner", "Color", "Year", "Make", "Model"
                vals[0] = HBold+(String)ReportTable.getValueAt(i,0)+HSlash; // award
                vals[1] = (String)ReportTable.getValueAt(i,2); // name
                vals[2] = (String)ReportTable.getValueAt(i,4); // color
                vals[3] = (String)ReportTable.getValueAt(i,3); // year
                vals[4] = (String)ReportTable.getValueAt(i,5); // make
                vals[5] = (String)ReportTable.getValueAt(i,6); // model
                vals[6] = (String)ReportTable.getValueAt(i,7); // score
            }
            if(pfScoreTblModel.getRowCount() > trow) {
                pfScoreTblModel.removeRow(i);
                pfScoreTblModel.insertRow(i,vals);
            }
            else {
                pfScoreTblModel.addRow(vals);
            }
            ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(vals);
//            actm.removeRow(prow); actm.insertRow(prow,vals);
            trow++;
            prow++;
            spaced = false;
        }
        printFrame.add(currentTable); // add the last table created to the Frame
        //pBook.append(new Printer(currentTable),preformat);
        Object[] o = new Object[1];
        ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(o);
        ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(o);
        JLabel hiClub = new JLabel("Most Represented Club: "+MostClubMembers.getText());
        JLabel nextHiClub = new JLabel("Second Most Club: "+SecondMostClub.getText());
        hiClub.setSize(new Dimension(hiClub.getText().length()*10, 24));
        nextHiClub.setSize(new Dimension(nextHiClub.getText().length()*10, 24));
        printFrame.add(hiClub);
        printFrame.add(nextHiClub);
        String[] v = new String[printTable.getColumnCount()];
        v[1] = HBold+"Most Represented Club"+HSlash;
        v[2] = MostClubMembers.getText();
        ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(v);
        String[] v1 = new String[printTable.getColumnCount()];
        v1[1] = HBold+"Next Most Club"+HSlash;
        v1[2] = SecondMostClub.getText();
        ((javax.swing.table.DefaultTableModel)printTable.getModel()).addRow(v1);
        //pBook.append(new Printer(hiClub), preformat);
        //pBook.append(new Printer(nextHiClub),preformat);
//        if(spanTable.getRowCount() <= prow) {
//            actm.addRow(o1);
//            actm.addRow(o1);
//        }
//        int[] r1 = {prow};
//        cellAtt.combine(r1,w); // modify the row
//        spanTable.setValueAt("Most Represented Club: "+MostClubMembers.getText(), prow, 0);
        prow++;
//        int[] r2 = {prow};
//        cellAtt.combine(r2, w);
//        spanTable.setValueAt("Second Most Club: "+SecondMostClub.getText(), prow, 0);
        prow++;
        //jprintFrame.add(printTable);
        jprintFrame.add(jsp);
//        jprintFrame.add(spanScroll);
//        jprintFrame.add(printFrame); // add the JPanel to the JFrame
        
        
        jprintFrame.pack();
        // The setSize(width, height), we need to dynamically size the height
        // so the print job renders properly (or so it appears)
        int sz = prow * 24;
        System.out.println("prow: "+prow+" * 24 = "+sz+"\n");
        jprintFrame.setSize(995,610);
        jprintFrame.setVisible(true);
        printFrame.setVisible(true);
        
        jprintFrame.setCursor(Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR));
        //java.awt.print.PageFormat pf = new java.awt.print.PageFormat();
        //pf.setPaper(new java.awt.print.Paper());
        //pf.setOrientation(java.awt.print.PageFormat.LANDSCAPE);
        //Printer p = new Printer(jprintFrame);
        //try {
        //    p.getNumberOfPages(printFrame.getPrintable(javax.swing.JTable.PrintMode.FIT_WIDTH, null, null), preformat);
        //} catch (PrinterException ex) {
        //    Logger.getLogger(CarShowUI.class.getName()).log(Level.SEVERE, null, ex);
        //}
        //pBook.append(new Printer(jprintFrame), pf);
//        pjob.setPrintable(new Printer(printFrame), preformat);
//        pjob.setPrintable(new Printer(printFrame), preformat);
        boolean showPrintDialog = true;
        boolean interactive = false;
        boolean fitWidth = true;
        PrintRequestAttributeSet attr = new javax.print.attribute.HashPrintRequestAttributeSet();
        attr.add(javax.print.attribute.standard.OrientationRequested.LANDSCAPE);
        //javax.print.attribute.Attribute att1 = javax.print.attribute.Attribute;
        JTable.PrintMode mode = fitWidth ? JTable.PrintMode.FIT_WIDTH
                                         : JTable.PrintMode.NORMAL;
        try {
        boolean complete = printTable.print(mode, header, footer,
                    showPrintDialog, attr,
                    interactive, null);
            if(!complete) {
                logger.log(Level.INFO,"Print of awards report cancelled");
            }
        } catch (PrinterException ex) {
            logger.log(Level.SEVERE,"Award print frame print failed", ex);
        }
        
        //System.out.println("num pages in print book:"+pBook.getNumberOfPages());
        //pjob.setPageable(pBook);
        //if(pjob.printDialog()) {
        //    try {
        //        pjob.print();

        //    } catch (PrinterException ex) {
        //        logger.log(Level.SEVERE,"Award print frame print failed", ex);
        //    }
        //}

    }//GEN-LAST:event_AwardsPrintButtonActionPerformed

    
    
    /**
     * makes the awards table for display
     * @return jtable object
     */
    private JTable buildAwardTable() {
        JTable retTable = new JTable(); // Award Winners
        retTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {},
            new String [] {
                "Award", "Owner", "Color", "Year", "Make", "Model", "Score"
            }
            ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        javax.swing.table.DefaultTableCellRenderer centerRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        javax.swing.table.DefaultTableCellRenderer leftRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        javax.swing.table.DefaultTableCellRenderer rightRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment( javax.swing.JLabel.CENTER );
        leftRenderer.setHorizontalAlignment( javax.swing.JLabel.LEFT );
        rightRenderer.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
        retTable.setFont(new java.awt.Font("Roman", java.awt.Font.PLAIN, 12));
        retTable.setShowHorizontalLines(true);
        retTable.setGridColor(java.awt.Color.gray);
        retTable.setShowHorizontalLines(true);
        retTable.setShowVerticalLines(false);
        for (int i = 0; i < retTable.getColumnModel().getColumnCount(); i++) {
            TableColumn column = retTable.getColumnModel().getColumn(i);
            if (i == 0) {
                column.setCellRenderer(centerRenderer);
                column.setPreferredWidth(110); // empirical width for widest award name
                column.setResizable(true); // when resized by user
            }
            else if (i == 1) { // class mnemonic & desc, wide
                column.setCellRenderer(leftRenderer);
                column.setPreferredWidth(170);
            }
            else if (i == 2) { // Name field
                column.setPreferredWidth(90);
            }
            else if (i == 3) { // year  - narrow to middling
                column.setPreferredWidth(50);
            }
            else {
                column.setPreferredWidth(70);
            }
        }
        retTable.setFillsViewportHeight(true);
        return retTable;
    }
    
    private JTable buildScoreTable() {
        javax.swing.table.DefaultTableCellRenderer centerRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        javax.swing.table.DefaultTableCellRenderer leftRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        javax.swing.table.DefaultTableCellRenderer rightRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment( javax.swing.JLabel.CENTER );
        leftRenderer.setHorizontalAlignment( javax.swing.JLabel.LEFT );
        rightRenderer.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
        JTable retTable = new JTable(); // Scored Trophy awards
            retTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {

                },
                new String [] {
                    "Rank", "Owner", "Color", "Year", "Make", "Model", "Score"
                }
                    ) {
                    Class[] types = new Class [] {
                        java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
                    };
                    boolean[] canEdit = new boolean [] {
                        false, false, false, false, false, false, false, false
                };

                public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
                }

                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return canEdit [columnIndex];
                }
            });
        retTable.setFont(new Font("ROMAN",Font.PLAIN,12));
        retTable.setShowHorizontalLines(true);
        retTable.setShowVerticalLines(false);
        for (int i = 0; i < retTable.getColumnModel().getColumnCount(); i++) {
            TableColumn column = retTable.getColumnModel().getColumn(i);
            if (i == 0) {
                column.setCellRenderer(leftRenderer);
                column.setPreferredWidth(20); // narrow ranking
            }
            else if (i == 1) { // name field wide
                column.setCellRenderer(leftRenderer);
                column.setPreferredWidth(170);
            }
            //else if (i == 2) { // color
            //    column.setPreferredWidth(80);
            //}
            else if (i == 3) { // year
                column.setWidth(40);
                //column.setPreferredWidth(40);
            }
            else if (i == 6) { // score
                column.setMaxWidth(40);
                column.setCellRenderer(rightRenderer);
            }
            else {
                column.setCellRenderer(centerRenderer);
                column.setPreferredWidth(80);
            }
        }
        return retTable;
    }
    
    /**
     * This ends up being the table formatter for the printed Awards
     * Report table.  It returns a JTable formatted with column widths
     * specified so if the widths are incorrect they are adjusted here.
     * The columns define as follows:
     * 
     * Rank  Name Color Year Make Model Score
     * @return 
     */
    private JTable buildPrintTable() {
        javax.swing.table.DefaultTableCellRenderer centerRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        javax.swing.table.DefaultTableCellRenderer leftRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        javax.swing.table.DefaultTableCellRenderer rightRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment( javax.swing.JLabel.CENTER );
        leftRenderer.setHorizontalAlignment( javax.swing.JLabel.LEFT );
        rightRenderer.setHorizontalAlignment(javax.swing.JLabel.RIGHT);
        JTable retTable = new JTable(); // Scored Trophy awards
            retTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {

                },
                new String [] {
                    "Rank", "Owner", "Color", "Year", "Make", "Model", "Score"
                }
                    ) {
                    Class[] types = new Class [] {
                        java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
                    };
                    boolean[] canEdit = new boolean [] {
                        false, false, false, false, false, false, false, false
                };

                public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
                }

                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return canEdit [columnIndex];
                }
            });
        retTable.setFont(new Font("ROMAN",Font.PLAIN,12));
        retTable.setShowHorizontalLines(true);
        retTable.setShowVerticalLines(false);
        for (int i = 0; i < retTable.getColumnModel().getColumnCount(); i++) {
            TableColumn column = retTable.getColumnModel().getColumn(i);
            if (i == 0) {
                column.setCellRenderer(centerRenderer);
                column.setWidth(60); // narrow ranking
            }
            else if (i == 1) { // name field wide
                column.setCellRenderer(leftRenderer);
                column.setPreferredWidth(170);
                //column.setWidth(170);
            }
            else if (i == 2) { // color
                column.setPreferredWidth(140);
            }
            else if (i == 3) { // year
                column.setWidth(40);
                //column.setPreferredWidth(40);
            }
            else if (i == 6) { // score
                column.setMaxWidth(40);
                column.setCellRenderer(rightRenderer);
            }
            else {
                column.setCellRenderer(centerRenderer);
                column.setPreferredWidth(80);
            }
        }
        return retTable;
    }
    /**
     * Save a copy of the database tables to CSV files for portable database
     * saving.  This routine uses the ReportTable as the key object to inform
     * the sqlClientReader what requested the data, and cause sqlClientReader
     * to create the database dump data.
     * @param evt 
     */
    private void AwardsSaveResultsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AwardsSaveResultsButtonActionPerformed
        String tble;
        String tblc;
        String tbls;
        if(winHost) {
            tble = CarShowConstants.winEntrants;
            tblc = CarShowConstants.winClubs;
            tbls = CarShowConstants.winScoring;
        }
        else {
            tble = CarShowConstants.Entrants;
            tblc = CarShowConstants.Clubs;
            tbls = CarShowConstants.Scoring;
        }
        String request = "select * from "+tble+";";  // use a keyword command to the DB
        AwardsWait.setEnabled(true);
        AwardsWait.setVisible(true);
        this.saveTable = "entrants";
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) setAwardsSaveResult(rs);
        AwardsWait.setVisible(false);
        //sqlGet(ReportTable, request);
        
        request = "select * from "+tblc+";";
        AwardsWait.setVisible(true);
        this.saveTable = "clubs";
        //sqlGet(ReportTable, request);
        rs = getDBData(request);
        if(rs.length > 0) setAwardsSaveResult(rs);
        AwardsWait.setVisible(false);
        request = "select * from "+tbls+";";
        AwardsWait.setVisible(true);
        this.saveTable = "scoring";
        //sqlGet(ReportTable, request);
        rs = getDBData(request);
        if(rs.length > 0) setAwardsSaveResult(rs);
    }//GEN-LAST:event_AwardsSaveResultsButtonActionPerformed

    /**
     * Implements the search capability from the Registration panel on entry
     * of a registration number.
     * @param evt 
     */
    private void EntrantNumberFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_EntrantNumberFocusLost
        //logger.log(Level.INFO,"EntNumFocusLost: entry evt: {0}",evt.paramString());
        String tbl;
        if(winHost) tbl = CarShowConstants.winEntrants;
        else tbl = CarShowConstants.Entrants;
        //if(evt.isTemporary()) logger.log(Level.INFO,"EntNumFocusLost:evt is temporary");
        //else logger.log(Level.INFO,"EntNumFocusLost:evt is permanent");
        focusSearch = true;
        if (! EntrantNumber.getText().equals("")) {
            int entNum = -1;
            try {
                entNum = new Integer(EntrantNumber.getText()).intValue();
            } 
            catch (NumberFormatException nfe) {
                EntrantNumber.setText("");
                //EntrantParking.requestFocus();
                FirstName.requestFocus();
                return;
            }
            if(entNum > 0) {
                regWait.setEnabled(true);
                regWait.setVisible(true);
                String request = "select * from "+tbl+
                    " where entrant_num="+entNum+";";
                HashMap[] rs = getDBData(request);
                if (rs.length > 0) setEntrant(rs);
                //sqlGet(RegistrationPanel, request);
                //waitForIt(regWait);
                regWait.setEnabled(false);
                regWait.setVisible(false);
                //focusSearch = false;
                //EntrantNumber.removeKeyListener(null);
                //FirstName.requestFocus();
            }
            else {
                clearEntrant();
                //EntrantParking.requestFocus();
                FirstName.requestFocus();
                focusSearch = false;
            }
        }
        if(!EntrantNumber.getText().equals("")) {
            if(debug) logger.log(Level.INFO,"EntNumFocusLost: turn On RegPrint");
            RegPrint.setVisible(true);
        }
    }//GEN-LAST:event_EntrantNumberFocusLost

    /**
     * Detects the change of the scoring server value on the Administration
     * panel and changes the setting for all subsequent DB calls to this new
     * server name.
     * @param evt 
     */
    private void ScoringServerNameFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ScoringServerNameFocusLost
        // set the global setting that is used by the SqlClientReader
/*        if(debug) logger.log(Level.INFO,"ScoringServerNameFocusLost: fired");
        boolean changed = false;
        if (ScoringServerName.getText().equals("")) {
            ScoringServerName.setText(CarShowConstants.defaultServer);
            changed = true; // dont know what it was before but empty is right out
        }
        else if(ScoringServerName.getText().equals(SQLServer)) {
            changed = false;
        }
        else if(ScoringServerName.getText().equals(CarShowConstants.defaultServer)) {
            changed = true;
        }
        else if(ScoringServerName.getText()
            .matches("[0-9]{2,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?")) {
            SQLServer = ScoringServerName.getText().trim();
            changed = true;
        }
        else {
            changed = true;
        }
        if (changed) {
            disconnect();
            if(!checkConnection()) {
                JOptionPane.showMessageDialog(tabbedPane,
                "Scoring Server "+ScoringServerName.getText() +
                " does not respond to a test connection verify the ",
                "server name and userid/password settings supplied", JOptionPane.ERROR_MESSAGE);
                ScoringServerName.requestFocus();
                return;
            } else {
                clearLocalTables();
            }
        }
        if(debug) logger.log(Level.INFO,"ScoringServerNameFocusLost: ScoringServerName: "+SQLServer);
        */
    }//GEN-LAST:event_ScoringServerNameFocusLost

    private void ClassSetPanelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ClassSetPanelFocusGained
        if(debug) logger.log(Level.INFO,"ClassSetPanelFocusGained fired");
        initClassTable();
    }//GEN-LAST:event_ClassSetPanelFocusGained

    private void RegPanelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_RegPanelFocusGained
        // When focus gained / restored to Registration Pane
        // request the classes and clubs lists and populate the dropdowns
        if(debug) logger.log(Level.INFO,"RegPanelFocusGained: event fired...:");
        if (!in_init) {
            initRegistration();
        }
    }//GEN-LAST:event_RegPanelFocusGained

    /**
     * Initialize the Registration Panel upon first selection or focus gained.
     * This will change the cursor to a hand, and tries to implement a wait
     * cursor when the class field waitLit is true.  That gets set to true
     * in the waitForIt() method, which is watching the objects on the screen
     * and the background SqlClientReader for the reply.
     */
    private void initRegistration() {
        regWait.setVisible(true);
        // initialize a cursor that differs from the standard with this code
        tabbedPane.addMouseMotionListener(new java.awt.event.MouseMotionListener() {
            @Override
            public void mouseMoved(java.awt.event.MouseEvent e) {
                // use this next bit for targeting the mouse more
                final int x = e.getX();
                final int y = e.getY();
                // only display a hand if the cursor is over the items
                java.awt.Rectangle cellBounds = tabbedPane.getBounds();
                if (cellBounds != null && cellBounds.contains(x, y) && waitLit) {
                    tabbedPane.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                } else {
                tabbedPane.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
                }
            }

            @Override
            public void mouseDragged(java.awt.event.MouseEvent e) {
            }
        });
        // default selection of hidden Pre-Reg selector button
        int itemcnt = EntrantClass.getItemCount();
        if(itemcnt == 0) {
            if(debug) logger.log(Level.INFO,"initReg: EntrantClass has 0 items");
            initClassList();
        }
        for(int i = 0; i < EntrantClass.getItemCount(); i++) {
            String c = (String)EntrantClass.getItemAt(i);
            if(c.equals("")) continue;
            c = c.substring(0,c.indexOf(" "));
            if(c.equals("PRE")) {
                EntrantClass.setSelectedIndex(i);
                break;
            }
        }
        itemcnt = EntrantClub.getItemCount();
        if(itemcnt == 0) {
            if(debug) logger.log(Level.INFO,"initReg: EntrantClub has 0 items");
            initClubsList();
        }
        FirstName.requestFocus();
        EntrantDeleteButton.setEnabled(false);
        if(debug) logger.log(Level.INFO,"initReg: done");
    }
    
    /**
     * This sets the order of tab traversal (which field is accessed after each
     * tab user input) on the Registration Panel.
     * 
     */
    private void setRegFocusTraversal() {
            javax.swing.FocusManager fm = javax.swing.FocusManager.getCurrentManager();
            javax.swing.JRootPane jrp = RegistrationPanel.getRootPane();
            java.util.Vector<java.awt.Component> flds = new java.util.Vector();
            flds.add(EntrantParking);
            flds.add(FirstName);
            flds.add(LastName);
            flds.add(EntrantAddress);
            flds.add(EntrantCity);
            flds.add(EntrantState);
            flds.add(EntrantZipCode);
            flds.add(EntrantPhone);
            flds.add(EntrantYear);
            flds.add(EntrantMake);
            flds.add(EntrantModel);
            flds.add(EntrantColor);
            flds.add(EntrantClass);
            flds.add(EntrantClub);
            flds.add(EntrantNumber);
            flds.add(FirstName);
            //flds.add(AddEntrant);
            //flds.add(EntrantSearch);
            //flds.add(EntrantClear);
            //if(RegPrint.isEnabled()) flds.add(RegPrint);
            //flds.add(PreRegButton);
            //regLayoutFocusTraversalPolicy rftp = new regLayoutFocusTraversalPolicy(flds);
            regLayoutFocusTraversalPolicy rftp = new regLayoutFocusTraversalPolicy(flds);
            RegistrationPanel.setFocusTraversalPolicy(rftp);
            RegistrationPanel.setFocusCycleRoot(true);
    }
    /**
     * Handles which tab was selected on user context/task change.  Based on
     * the selected tab, take the appropriate init actions for that tab.
     */
    private void tabbedPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tabbedPaneStateChanged
        if (rTimer != null && rTimer.isRunning()) { 
            rTimer.stop();
            rTimer.removeActionListener(rptActionListener); //removes the one registered listener
            rTimer = null;
        }
        // This makes the enter key work as the Save button on the judging sheet
        //getRootPane().setDefaultButton((javax.swing.JButton)actDefaultButton);
        // It needs to be reset on other panes/tabs however
        javax.swing.JTabbedPane pane = (javax.swing.JTabbedPane)evt.getSource();
        int sel = pane.getSelectedIndex();
        switch (sel) {
            case 0:
                if(debug) logger.log(Level.INFO,"Registration Tab Focus Selected");
                if(!in_init) {
                    clearEntrant();
                    if(validServer) initClassList();
                    setClass("PRE");
                    //int sleepcnt = 0;
                    if(regWait.isVisible()) { 
                        logger.log(Level.SEVERE,"tabbedPane stateChange"+
                            "regWait still lit after iniClassList()");
                        ((myJTabbedPane)tabbedPane).whichWaitActive();
                        ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClass);
                    }
                    if(validServer) initClubsList();
                    if(regWait.isVisible()) {
                        logger.log(Level.SEVERE,"tabbedPane stateChange"+
                            "regWait still lit after iniClassList()");
                        ((myJTabbedPane)tabbedPane).whichWaitActive();
                        ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClub);
                    }
                    EntrantDeleteButton.setEnabled(false);
                    //EntrantParking.requestFocus();
                    FirstName.requestFocus();
                }
                else {
                    if(debug) logger.log(Level.INFO,"in_init defer initting...");
                }
                break;
            case 1:
                if(debug) logger.log(Level.INFO,"Class Admin Tab Selected");
                if(validServer) initClassTable();
                NewClassMnemonic.requestFocus();
                break;
            case 2:
                if(debug) logger.log(Level.INFO,"Judging Sheet Tab Selected");
                if(validServer) setSpecialAwards();
                JS_SaveButton.setForeground(java.awt.Color.BLACK);
                clearJudgingSheet((byte)7);
                // This makes the enter key behave as the Save button on this panel
                // To get the enter key to behave as a search button we need
                // to use the key listener
                //
                //getRootPane().setDefaultButton(JS_SaveButton);
                //
                // this behavior needs to be reset however for the other
                // panes/tabs and it wasn't really helpful so I removed it - wdm
                JS_EntrantNumber.requestFocus();
                break;
            case 3:
                if(debug) logger.log(Level.INFO,"Judging Tab Selected");
                if(validServer) schedReport();
                break;
            case 4:
                if(debug) logger.log(Level.INFO,"Awards Tab Selected");
                if(validServer) getAwardsReport();
                break;
            case 5:
                if(debug) logger.log(Level.INFO,"Admin Panel Selected");
                if(validServer) getAdminData();
                break;
            default:
                if(debug) logger.log(Level.INFO,"Unknown Tab Selected");
        }
    }//GEN-LAST:event_tabbedPaneStateChanged

    /**
     * This FocusLost block implements the search & populate function of the
     * Judging Sheet data entry operation.  The entered registration number
     * triggers the DB request to populate the form, if the data request
     * is for a non-existent registration number it clears the form for another
     * cycle.  If existing, it populate the form with the registration data
     * then proceeds to look for judging data from the Scoring table.  There
     * is a boolean flag set to indicate if there was Scoring data which is
     * used later in the Judging Sheet Save Action Performed block to indicate
     * a Scoring insert vs. an update operation.
     * @param evt 
     */
    private void JudgeSheetEntNumberFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_JudgeSheetEntNumberFocusLost
        JS_SaveButton.setForeground(java.awt.Color.BLACK);
        if(debug) logger.log(Level.INFO,"JudgeSheetEntrantNumber Focus Lost fired!");
        if(!(JS_EntrantNumber.getText().equals(""))) {
            if(!(JS_EntrantNumber.getText().matches("[1-9][0-9]*"))) {
                JOptionPane.showMessageDialog(tabbedPane,
                    "Judge sheet entrant number is not a number (" +
                    JS_EntrantNumber.getText()+")",
                    "Judging Entrant Number Error", JOptionPane.ERROR_MESSAGE);
                JS_EntrantNumber.setText("");
                JS_EntrantNumber.requestFocus();
            }
            else {
                int entNum = new Integer(JS_EntrantNumber.getText()).intValue();
                if(currentJudgingEntrant == null || currentJudgingEntrant.equals(""))
                    currentJudgingEntrant = JS_EntrantNumber.getText();
                else {
                    if(!JS_EntrantNumber.getText().equals(currentJudgingEntrant))
                        clearJudgingSheet((byte)7); // clear entrant & judge scores
                }
                String tble;
                String tbls;
                if(winHost) {
                    tble = CarShowConstants.winEntrants;
                    tbls = CarShowConstants.winScoring;
                }
                else {
                    tble = CarShowConstants.Entrants;
                    tbls = CarShowConstants.Scoring;
                }
                if(entNum > 0) {
                    String request = "select entrant_num, make, model, "+
                        "parking_loc, color, year, mnemonic, aw1, aw2 from "+
                        tble+" where entrant_num = "+entNum+";";

                    judgingSheetWait.setEnabled(true);
                    judgingSheetWait.setVisible(true);
                    //sqlGet(JudgeSheetPanel, request);
                    HashMap[] rs = getDBData(request);
                    if(rs.length > 0) setJudgingEntrant(rs);
                    request = "select * from "+tbls+
                        " where entrant_num = "+JS_EntrantNumber.getText()+";";
                    judgingSheetWait.setEnabled(true);
                    judgingSheetWait.setVisible(true);

                    rs = getDBData(request);
                    if(rs.length > 0) setJudgingData(rs);
                    Iterator<javax.swing.JTextField> fiter = JudgingFields.iterator();
                    while(fiter.hasNext()) {
                        javax.swing.JTextField c = fiter.next();
                        if(c.getText().equals("")) {
                            c.requestFocus();
                            break;
                        }
                    }
                }
                else {
                    JS_EntrantNumber.setText("");
                    JS_EntrantNumber.requestFocus();
                }
                currentJudgingEntrant = JS_EntrantNumber.getText();
            }
            judgingSheetWait.setEnabled(false);
            judgingSheetWait.setVisible(false);
        }
        else { // empty judging # specified, clear the form of non-active data
            clearJudgingSheet((byte)7); // clear entrant & judge scores
            JS_EntrantNumber.requestFocus();
        }
    }//GEN-LAST:event_JudgeSheetEntNumberFocusLost

    /**
     * Save the entered values on the Judging Sheet (judging data entry) form.
     * This is a really complicated bit of code that enforces the various
     * constraints on the judging data input.  A short list of these:
     * 1. Data entered must have judge initials
     * 2. Only 1 award allowed excepting Participants Choice
     * 3. Participants Choice can be assigned to anybody
     * 4. Valid (numeric, positive, non-zero) entrant registration number (obviously)
     * 5. Only numeric values in scores
     * 6. Scores within limits (1-20 or 1-10 depending on score category)
     * 
     * TODO: Make categories and max values settable within the preferences.xml
     * 
     * Internally, it also must be sensitive to first Scoring entry versus
     * subsequent (which really are when to use insert vs. update SQL statements)
     * It also needs to handle that corner case where one entrant could win
     * an award and also be given the Participants Choice award.
     * @param evt 
     */
    private void JudgeSheetSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JudgeSheetSaveActionPerformed
        /* TODO: Make categories and max values settable within the preferences.xml */
        if(debug) logger.log(Level.INFO,"JS_SaveActPerf: entry, evt: {0}",evt.getActionCommand());
        int boxesSeen = 0;  // used to determine how many awards chkd
        boolean deleteCase = false; // flag used when delete/remove award is detected
        boolean j1Populated = false; // flag when judge1 vals & initials present
        boolean j2Populated = false; // flag when judte2 vals & inits present
        String tble; // localized table names (deprecated b/c table names now are lowercase)
        String tbls; // in all platforms
        String tblss;
        if(winHost) {
            tble = CarShowConstants.winEntrants;
            tbls = CarShowConstants.winScoring;
            tblss = CarShowConstants.winSpecials;
        }
        else {
            tble = CarShowConstants.Entrants;
            tbls = CarShowConstants.Scoring;
            tblss = CarShowConstants.Specials;
        }
        // check each field for valid input, start with entrant number
        if(!JS_EntrantNumber.getText().matches("[1-9][0-9]*")) {
            JOptionPane.showMessageDialog(tabbedPane,
                "Judge sheet entrant number is not a number (" +
                JS_EntrantNumber.getText()+")",
                "Judging Entrant Number Error", JOptionPane.ERROR_MESSAGE);
            JS_EntrantNumber.requestFocus();
            return;
        }
        else { // entrant# OK, ck the rest
            String EntNum = JS_EntrantNumber.getText().trim();
            // loop over the judging scores data using the List in JudgingFields
            if(debug) logger.log(Level.INFO,"JdgSheetSaveActPerf: newScoreEntry: {0}",newScoreEntry);
            Iterator<javax.swing.JTextField> fiter = JudgingFields.iterator();
            while(fiter.hasNext()) {
                javax.swing.JTextField c = fiter.next();
                if(!c.getText().equals("")) {
                    if(!c.getText().matches("[0-9]*") && !c.getText().equals("")) {
                        if(EntNum.matches("[1-9][0-9]*")) {
                            JOptionPane.showMessageDialog(tabbedPane,
                                "Judge score entered is not a number (" +
                                c.getText()+")",
                                "Judging Score Entry Error", JOptionPane.ERROR_MESSAGE);
                            c.requestFocus();
                            return;
                        }
                    }
                    else {
                        int val = Integer.parseInt(c.getText());
                        String name = c.getName();
                        if(name.matches("j[12]_cat[1234]")) {
                            if (val > 20) {
                                JOptionPane.showMessageDialog(tabbedPane,
                                    "Judge score ("+c.getText()+") larger than permitted value 20",
                                    "Judging Score Entry Error", JOptionPane.ERROR_MESSAGE);
                                c.requestFocus();
                                return;
                            }
                        }
                        else {
                            if (val > 10) {
                                JOptionPane.showMessageDialog(tabbedPane,
                                    "Judge score ("+c.getText()+") larger than permitted value 10",
                                    "Judging Score Entry Error", JOptionPane.ERROR_MESSAGE);
                                c.requestFocus();
                                return;
                            }
                        }
                        if(name.matches("j1_cat[1-6]")) j1Populated = true;
                        else j2Populated = true;
                    }
                }
            }
            // VALIDATE AWARD BOXES
            // Use the AwardsShared hashmap which is initialized by the
            // setSpecialAwards() operation, to validate if an award can
            // be shared with another.  This is in addition to the check
            // to see if an award has already been awarded to an entrant
            // the awardsChanged flag gets set by any action performed on
            // one of the checkboxes
            if(awardsChanged) {
                setSpecialAwards();
                int btnCount = 0;
                javax.swing.JCheckBox lastChecked = null;
                Iterator aiter = AwardsBoxes.iterator();
                while(aiter.hasNext()) {
                    javax.swing.JCheckBox c = (javax.swing.JCheckBox)aiter.next();
                    if(c.isVisible() && c.isSelected()) {
                        String boxName = ((String)c.getName()).replace("Box", "");
                        if(SpecialAwards.containsKey(boxName)) {
                            // this award has already been assigned in our last
                            // lookup of the SpecialAwards data.  Eval if it's this
                            // entrant or a different one...
                            // empty/0 is OK in the field
                            if(!JS_EntrantNumber.getText().equals(SpecialAwards.get(boxName))) {
                                if(// !SpecialAwards.get(boxName).equals("") ||
                                    !SpecialAwards.get(boxName).equals("0")) {
                                // Yes, they differ, so warn the user...
                                JOptionPane.showMessageDialog(tabbedPane,
                                    "The award "+c.getText()+" has already been awarded to "+
                                    " registration # "+SpecialAwards.get(c.getText()),
                                    "Judging Score Entry Error", JOptionPane.ERROR_MESSAGE);
                                //c.setSelected(false);
                                c.requestFocus();
                                return;
                            }
                            }
                        }
                        btnCount++;
                        boxesSeen++;
                        if(boxesSeen > 1) {
                            // if lastChecked not null AND if both
                            // AwardShare(lastChecked)!=allow AND AwardShare(c)!=allow
                            if(lastChecked != null && 
                                    !(this.AwardsShared.get(lastChecked.getText()).equals(
                                    Integer.toString(CarShowConstants.allowShare))
                                    || AwardsShared.get(c.getText()).equals(
                                    Integer.toString(CarShowConstants.allowShare)))) {
                                JOptionPane.showMessageDialog(tabbedPane,
                                    "Neither award "+c.getText()+" nor "+
                                    lastChecked.getText()+" allow sharing with another award.",
                                    "Judging Score Entry Error", JOptionPane.ERROR_MESSAGE);
                                //c.setSelected(false);
                                c.requestFocus();
                                return;
                            }
                        }
                        lastChecked = c;
                    }
                    // Delete case check
                    else if(c.isVisible() && !c.isSelected() && SpecialAwards.get(c.getText()).equals(EntNum)) {
                        // This item was deleted, set flag
                        deleteCase = true;
                    }
                }
                //if(boxesSeen > 1) { // && !Award7Box.isSelected()) {
                    // check if the selected box is shareable
                    // already know this isnt assigned in SpecialAwards
                    //
                    //if()
                    //JOptionPane.showMessageDialog(tabbedPane,
                    //    "Invalid awards selection - only Participants Choice can \n"+
                    //    "be selected along with another Specialty Award.  \nAll "+
                    //    "other awards are exclusive.", "Judging Score Entry Error", 
                    //    JOptionPane.ERROR_MESSAGE);
                    //lastChecked.requestFocus();
                    //return;
                //}
                if(boxesSeen == 0) {
                    // remove award case
                    deleteCase = true;
                }
            }
        }
        String EntNum = JS_EntrantNumber.getText().trim();
        StringBuilder sb = new StringBuilder();
        boolean haveJI1 = false;
        boolean haveJI2 = false;
        if(!JS_JudgeInitials1.getText().equals("")) {
            haveJI1 = true;
        }
        if(!JS_JudgeInitials2.getText().equals("")) {
            haveJI2 = true;
        }
        if((!haveJI1 & j1Populated) || (!haveJI2 & j2Populated)) {
            JOptionPane.showMessageDialog(tabbedPane,
                "No judging initials entered",
                "Judging Score Entry Error", JOptionPane.ERROR_MESSAGE);
            if(!haveJI1 & j1Populated)
                JS_JudgeInitials1.requestFocus();
            else JS_JudgeInitials2.requestFocus();
            return;
        }
        // form score data stmt (what there is of it) send it to the server
        // depending upon if the award has been previously awarded we insert or update
        // or delete if deleteCase = true
        Iterator<javax.swing.JTextField> fiter = JudgingFields.iterator();
        if(newScoreEntry && EntNum != null && !EntNum.equals("") ) {  // insert Scoring data case
            sb.append("insert into ");
            sb.append(tbls); // scoring table
            sb.append(" ( ");
            sb.append("entrant_num");
            while(fiter.hasNext()) {
                javax.swing.JTextField c = fiter.next();
                //if(!c.getText().equals("")) {
                    sb.append(", ");
                    sb.append(c.getName());
                //}
            }
            sb.append(", Judge1 ");
            sb.append(", Judge2 ");
            sb.append(") values ( ");
            sb.append(EntNum);
            fiter = JudgingFields.iterator();
            while(fiter.hasNext()) {
                javax.swing.JTextField c = fiter.next();
                if(!c.getText().equals("")) {
                    sb.append(", ");
                    sb.append(c.getText());
                }
                else {
                    sb.append(", 0");
                }
            }
            sb.append(", \""+JS_JudgeInitials1.getText()+"\"");
            sb.append(", \""+JS_JudgeInitials2.getText()+"\"");
            sb.append(")");
        }
        else {  // update Scoring table data case
            sb.append("update ");
            sb.append(tbls); // scoring table
            sb.append(" set ");

            boolean firstparam = true;
            while(fiter.hasNext()) {
                javax.swing.JTextField c = fiter.next();
                if(!c.getText().equals("")) {
                    if(!firstparam) sb.append(", ");
                    else firstparam=false;
                    sb.append(c.getName());
                    sb.append(" = ");
                    sb.append(c.getText());
                }
                else {
                    if(!firstparam) sb.append(", ");
                    else firstparam = false;
                    sb.append(c.getName());
                    sb.append(" = 0");
                }
            }
            sb.append(", Judge1 = \""+JS_JudgeInitials1.getText()+"\"");
            sb.append(", Judge2 = \""+JS_JudgeInitials2.getText()+"\"");
            sb.append(" where entrant_num = ");
            sb.append(JS_EntrantNumber.getText());
        }
        // Execute the insert or update rqst constructed in the StringBuilder sb
        if(sb.length() > 0) {
            judgingSheetWait.setEnabled(true);
            judgingSheetWait.setVisible(true);
            int ret;
            ret = execDBUpdate(sb.toString());
            if(!(ret > 0)) logger.log(Level.WARNING,"JdugeSheetActPerf: scoring tbl init/upd for {0} ret: {1}",
                    new Object[] {sb.toString(), ret});
            if(newScoreEntry) newScoreEntry = false;
            //sqlPut(JudgeSheetSubPanel, sb.toString());
            //waitForIt(judgingSheetWait);
            int j1total = 0;
            int j2total = 0;
            if (!JS_BodyScore1.getText().equals(""))  
                j1total += Integer.parseInt(JS_BodyScore1.getText());
            if (!JS_EngineScore1.getText().equals("")) 
                j1total += Integer.parseInt(JS_EngineScore1.getText());
            if (!JS_InteriorScore1.getText().equals(""))
                j1total += Integer.parseInt(JS_InteriorScore1.getText());
            if( !JS_ChassisScore1.getText().equals(""))
                j1total += Integer.parseInt(JS_ChassisScore1.getText());
            if(!JS_TireScore1.getText().equals(""))
                j1total += Integer.parseInt(JS_TireScore1.getText());
            if(!JS_WheelsScore1.getText().equals(""))
                j1total += Integer.parseInt(JS_WheelsScore1.getText());
            if(!JS_BodyScore2.getText().equals(""))
                j2total += Integer.parseInt(JS_BodyScore2.getText());
            if(!JS_EngineScore2.getText().equals(""))
                j2total += Integer.parseInt(JS_EngineScore2.getText());
            if(!JS_InteriorScore2.getText().equals(""))
                j2total += Integer.parseInt(JS_InteriorScore2.getText());
            if(!JS_ChassisScore2.getText().equals(""))
                j2total += Integer.parseInt(JS_ChassisScore2.getText());
            if(!JS_TireScore2.getText().equals(""))
                j2total += Integer.parseInt(JS_TireScore2.getText());
            if(!JS_WheelsScore2.getText().equals(""))
                j2total += Integer.parseInt(JS_WheelsScore2.getText());
            if(debug) logger.log(Level.INFO,"JdgShtSaveActPerf: judge1 total: {0}",j1total);
            if(debug) logger.log(Level.INFO,"JdgShtSaveActPerf: judge2 total: {0}",j2total);
            String request = "update "+tbls+" set j1_total = "+
                j1total+" , j2_total = "+j2total+" where entrant_num = "+
                EntNum;
            ret = execDBUpdate(request);
            if(!(ret > 0)) logger.log(Level.WARNING,"JdugeSheetActPerf: scoring "+
                    "tbl judge totals upddate for {0} ret: {1}",
                    new Object[] {JS_EntrantNumber.getText(), ret});
            //sqlPut(JudgeSheetSubPanel, request);
            //waitForIt(judgingSheetWait);
            //if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
            // Parse the awards checkboxes next, updating those verbatim
            // first see if any *are* checked & known to be valid by now
            // this will be zero if we never went through the routine
            // above (awardsChanged = false)
            if(boxesSeen > 0 || deleteCase) {
                int lastAwardCount = 0; // count of this entrant in SpecialAwards
                Iterator it = SpecialAwards.values().iterator();
                if(it.next().equals(EntNum)) lastAwardCount++;
                int awardscnt = 0; // current showing count
                sb = new StringBuilder(); // Entrants update string
                StringBuilder specialsSb1 = new StringBuilder();
                StringBuilder specialsSb2 = null; // for 2 awards case
                StringBuilder specialsSb3 = null; // for corner case
                if(SpecialAwards.size() > 0) { // deleteCase only applies in this block
                    Iterator citer = AwardsBoxes.iterator();
                    while(citer.hasNext()) {
                        JCheckBox c = (JCheckBox)citer.next();
                        if(c.isSelected()) {
                            if(boxesSeen == 1 || specialsSb1.length() == 0) {
                                String boxName = c.getName().replace("Box","");
                                if (SpecialAwards.containsKey(boxName))  {
                                    if(SpecialAwards.get(boxName).equals(JS_EntrantNumber.getText())
                                      || SpecialAwards.get(boxName).equals("")
                                      || SpecialAwards.get(boxName).equals("0")) {
                                        if(sb.length() == 0) {
                                           sb.append("update " + tble + " set aw1 = \"").append(boxName).append("\"");
                                           specialsSb1.append("update "+tblss // Specials table
                                           +" set entrant_num = "+EntNum
                                           +" where award = \""+boxName+"\"");
                                           awardscnt++;
                                        }
                                        else {
                                            sb.append(", aw2 = \"\"");//.append(boxName).append("\"");
                                            if(specialsSb2 != null) {
                                                specialsSb3 = new StringBuilder();
                                                specialsSb3.append("update "+tble+" set aw1 = \""+(boxName)+("\""));
                                            }
                                            else {
                                                specialsSb2 = new StringBuilder();
                                                specialsSb2.append("update "+tble+" set aw1 = \""+(boxName)+("\""));
                                            }
                                            if(specialsSb1.length() == 0) {
                                                specialsSb1.append("update "+tblss // Specials table
                                                  +" set entrant_num = "+EntNum
                                                  +" where award = \""+boxName+"\"");
                                            }
                                            else {
                                                 specialsSb1.append(", entrant_num = "+EntNum
                                                  +" where award = \""+boxName+"\"");
                                            }
                                        }
                                    }
                                }
                                else { // new entry case
                                    sb.append("update "+CarShowConstants.Entrants
                                      +" set aw1 = \""+c.getName()+"\"");
                                    specialsSb1.append("insert into "+tblss // Specials table
                                      +" ( award , entrant_num ) values ( \""
                                      +boxName+"\" , "
                                      +EntNum+")");
                                    awardscnt++;
                                }
                            }
                            else  {// 2 boxes assumed...
                                if(SpecialAwards.containsKey(c.getName().replace("Box",""))) {
                                    if(SpecialAwards.get(c.getName().replace("Box","")).equals(EntNum) ||
                                        SpecialAwards.get(c.getName().replace("Box","")).equals("") ||
                                        SpecialAwards.get(c.getName().replace("Box","")).equals("0")) {
                                            sb.append(", aw2 = \"").append(c.getName().replace("Box","")).append("\"");
                                            if(specialsSb2 == null) specialsSb2 = new StringBuilder();
                                            specialsSb2.append("update "+tblss
                                            +" set entrant_num = "+EntNum
                                            +" where "+tblss+".award = \""+c.getName().replace("Box","")+"\"");
                                    }
                                }
                                else { // this should never be encountered...
                                    logger.log(Level.WARNING,"initializing in JudgeSave Specials for award: {0}",c.getName());
                                    sb.append(", aw2 = \"").append(c.getName().replace("Box","")).append("\"");
                                    specialsSb2 = new StringBuilder();
                                    specialsSb2.append("insert into "+CarShowConstants.Specials+
                                    " ( award, entrant_num ) values (\""+c.getName().replace("Box","")+
                                    "\" , "+EntNum+")");
                                }
                            }
                        }
                        else { // Award remove from user case
                            if(SpecialAwards.containsKey(c.getName().replace("Box",""))) {
                                if(SpecialAwards.get(c.getName().replace("Box","")).equals(EntNum)) {
                                    if(sb.length() == 0)
                                        sb.append("update "+tble); // Entrants table
                                    if(awardscnt == 0) {
                                        sb.append(" set aw1 = \"\"");
                                        awardscnt++;
                                    }
                                    else {
                                        if(sb.toString().contains("set"))
                                            sb.append(", aw2 = \"\"");
                                        else sb.append(" set aw2 = \"\"");
                                    }
                                    if(specialsSb1.length() == 0)
                                        specialsSb1.append("update "+tblss
                                        +" set entrant_num=0 where award = \""+c.getName().replace("Box","")+"\"");
                                    else {
                                        specialsSb2 = new StringBuilder();
                                        specialsSb2.append("update "+tblss+
                                        " set entrant_num=0 where award = \""+c.getName().replace("Box","")+"\"");
                                    }
                                }
                            }
                        }
                    }
                    if(sb.length() > 0) sb.append(" where entrant_num = "+EntNum);
                    if(specialsSb2 != null && specialsSb2.indexOf(tble) > 0) specialsSb2.append(" where entrant_num = "+EntNum);
                    if(specialsSb3 != null && specialsSb3.length() > 0) specialsSb3.append(" where entrant_num = "+EntNum);
                }   
                else {  // no SpecialAwards yet, should never happen now...
                    logger.log(Level.WARNING,"no specials table, force init in JudgeSaveActPerf");
                    specialsSb1.append("insert into "+tblss+
                        " (award, entrant_num) values ( ");
                    if(boxesSeen > 1) {
                        specialsSb2 = new StringBuilder();
                        specialsSb2.append("insert into "+tblss+
                            " (award, entrant_num) values ( ");
                    }
                    sb.append("update "+tble+" set ");
                    Iterator aiter = AwardsBoxes.iterator();
                    while(aiter.hasNext()) {
                        javax.swing.JCheckBox c = (javax.swing.JCheckBox)aiter.next();
                        if(c.isSelected()) { // here's one
                            if(awardscnt == 0)  {
                                sb.append("aw1 = \"");
                                awardscnt++;
                                specialsSb1.append("\""+c.getName().replace("Box","")+"\", "+EntNum+")");
                            }
                            else {
                                sb.append(", aw2 = \"");
                                specialsSb2.append("\""+c.getName().replace("Box","")+"\", "+EntNum+")");
                            }
                            sb.append(c.getName()+"\" ");
                        }
                    }
                    sb.append(" where entrant_num = "+EntNum);
                }
                if (sb.length() > 0) {
                    judgingSheetWait.setVisible(true);
                    ret = execDBUpdate(sb.toString());
                    if(!(ret > 0)) logger.log(Level.WARNING,"JdugeSheetActPerf: "+
                            "scoring tbl init/upd for {0} ret: {1}",
                    new Object[] {JS_EntrantNumber.getText(), ret});
                    //sqlPut(specialtyAwardsLabel, sb.toString());
                    //waitForIt(judgingSheetWait);
                    //if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
                }
                if(specialsSb1.length() > 0) {
                    if(debug) logger.log(Level.INFO,"JSSaveActPerf: handling specialsSb1: {0}",specialsSb1.toString());
                    judgingSheetWait.setVisible(true);
                    ret = execDBUpdate(specialsSb1.toString());
                    //sqlPut(specialtyAwardsLabel, specialsSb1.toString());
                    //waitForIt(judgingSheetWait);
                    //if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
                }
                if(specialsSb2 != null) {
                    if(debug) logger.log(Level.INFO,"JSSaveActPerf: handling specialsSb1: {0}",specialsSb1.toString());
                    judgingSheetWait.setVisible(true);
                    ret = execDBUpdate(specialsSb2.toString());
                    judgingSheetWait.setVisible(false);
                    //sqlPut(specialtyAwardsLabel, specialsSb2.toString());
                    //waitForIt(judgingSheetWait);
                    //if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
                }
                if(specialsSb1.length() > 0 || specialsSb2 != null) {
                    if(debug) logger.log(Level.INFO,"JSSaveActPerf: call setSpecialAwards()");
                    setSpecialAwards();
                }
            }
            judgingSheetWait.setVisible(false);
            fiter = JudgingFields.iterator();
            while(fiter.hasNext()) {
                javax.swing.JTextField c = fiter.next();
                if(c.getText().equals("")) {
                    c.requestFocus();
                    break;
                }
            }            
        }
    }//GEN-LAST:event_JudgeSheetSaveActionPerformed

    /**
     * Detects the click into the EntrantNumber text field on the Registration
     * panel.  This implements the clear field on the Entrant number field
     * when you click into it.
     * @param evt 
     */
    private void EntNumMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EntNumMouseClicked
        if(debug) logger.log(Level.INFO,"EntNumMouseClicked hit! Clear EntrantNumber");
        EntrantNumber.setText("");
    }//GEN-LAST:event_EntNumMouseClicked

    /**
     * Print action performed block to trigger the printing of the scoring
     * sheets on button click.
     * @param evt 
     */
    private void RegPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegPrintActionPerformed
        if(debug) logger.log(Level.INFO,"RegPrtActPerf: printScoringSheets");
        if(((String)EntrantClass.getSelectedItem()).substring
                (0,((String)EntrantClass.getSelectedItem()).indexOf(" ")).toUpperCase().contains("MC")) {
            printScoringSheets(1);
        }else
            printScoringSheets(0);
        //printScoringSheets();
    }//GEN-LAST:event_RegPrintActionPerformed

    /**
     * This action performed block captures changes to any of the judging
     * award check boxes.  This is used in the save operation to determine if
     * we need to evaluate the check boxes for add/remove of named "special"
     * award.
     * @param evt judging award box checked event
     */
    private void JSBoxesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JSBoxesActionPerformed
        if(debug) logger.log(Level.INFO,"JSBoxesActPerf: {0} box checked...",evt.getActionCommand());
        logger.log(Level.INFO,"JSBoxesActPerf: action cmd string: "+evt.getActionCommand());
        awardsChanged = true;
        
    }//GEN-LAST:event_JSBoxesActionPerformed

    /**
     * Toggle the debug flag.  When implemented, this will turn the debug
     * statements output off and on.
     * @param evt 
     */
    private void debugButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_debugButtonActionPerformed
        if(debug == true) {
            debug = false;
            //SqlClientReader.setDebug(false);
            myJTabbedPane.setDebug(false);
        }
        else {
            debug = true;
            //SqlClientReader.setDebug(true);
            myJTabbedPane.setDebug(true);
        }
    }//GEN-LAST:event_debugButtonActionPerformed

    /**
     * Handler for when the NewClassMnemonic field on the Classes Admin Panel
     * loses focus (somebody tabbed/clicked out of the field) which triggers
     * the search for an already used value of mnemonic.  If already used,
     * a pop-up will inform the user.
     * @param evt 
     */
    private void NewClassFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_NewClassFocusLost
        String s = NewClassMnemonic.getText();
        if(debug) logger.log(Level.INFO,"NewClassMnemonicFocusLost fired...");
        if(activeClasses != null) {
            for (int i = 0; i < activeClasses.length; i++) {
                // audit the classes and see if there is a preexisting class of this name
                if(activeClasses[i].equals(s)) {
                    JOptionPane.showMessageDialog(tabbedPane,
                      "Class label is already in use. Please choose a" +
                      " different label for this new class.",
                      "Class Data", JOptionPane.ERROR_MESSAGE);
                    NewClassMnemonic.setText("");
                    NewClassMnemonic.requestFocus();
                    return;
                }
            }
        }
    }//GEN-LAST:event_NewClassFocusLost
    /**
     * Clear the registration number field on the Judging Sheet panel when
     * the user clicks into that field on the form.
     * @param evt 
     */
    private void JS_RegNumFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_JS_RegNumFocusGained
        JS_EntrantNumber.setText("");
        JS_SaveButton.setForeground(java.awt.Color.BLACK);
    }//GEN-LAST:event_JS_RegNumFocusGained

    /**
     * action handler for save show data operation of Administration panel.
     * When the show name, show date or location are changed, this is the
     * handler that runs when the user presses the save button for these
     * fields.
     * @param evt 
     */
    private void SaveAdminActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveAdminActionPerformed
        if(debug) logger.log(Level.INFO,"SaveAdminActPerf: event is {0}",evt.paramString());
        if(ShowDate.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
              "Show date is unset.",
              "Show Data", JOptionPane.ERROR_MESSAGE);
            ShowDate.requestFocus();
            return;
        }
        if(ContestName.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
              "Car show contest name is unset.",
              "Show Data", JOptionPane.ERROR_MESSAGE);
            ContestName.requestFocus();
            return;
        }
        String tbls;
        if(winHost) tbls = CarShowConstants.winShowData;
        else tbls = CarShowConstants.ShowData;
        // this will enforce location settings, we won't require it for
        // the beta release
        /*if(ShowLocation.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
              "Show location is unset.",
              "Show Data", JOptionPane.ERROR_MESSAGE);
            ShowLocation.requestFocus();
            return;
        } */
        StringBuilder sb = null;
        StringBuilder sb2 = null;
        boolean name_chg = false;
        boolean date_chg = false;
        //ShowDate.setText(ShowDate.getText().replaceAll("~","").replaceAll("\"","").trim());
        String  parsedDate = ShowDate.getText().replace(", ", "~ ");
        String parsedName = ContestName.getText().replaceAll("\"","").replaceAll(",",".").trim();
        String parsedLoc = ShowLocation.getText().replaceAll("\"","").replaceAll(",",".").trim();

        if((CurrentCarShowName == null) || (CurrentCarShowName != null && 
                !CurrentCarShowName.equals(ContestName.getText())))
            name_chg = true;
        else name_chg = false;
        if (!ShowDate.getText().equals(CarShowDate))
            date_chg = true;
        else date_chg = false;

        if(date_chg || name_chg) {
            if(CurrentCarShowName != null) {
                sb = new StringBuilder();
                sb2 = new StringBuilder();
                sb.append("DELETE FROM "+tbls+" WHERE "+
                    "showname = \""+CurrentCarShowName+"\"");
                CurrentCarShowName = null;

                sb2.append("INSERT INTO "+tbls+
                    "(showname, showdate, location) values ( \""+parsedName+
                    "\" , \""+parsedDate+"\", \""+parsedLoc+"\")"); 
            }
            else {  // no data in DB if CurrentCarShowName == NULL
                sb2 = new StringBuilder();
                sb2.append("INSERT INTO "+tbls+
                    "(showname, showdate, location) values ( \""+parsedName+
                    "\" , \""+parsedDate+"\", \""+parsedLoc+"\")");
            }
        }
        
        if(sb != null) {
            if(debug) logger.log(Level.INFO,"SaveAdmActPerf: sending: {0}",sb.toString());
            AdminWait.setEnabled(true);
            AdminWait.setVisible(true);
            int ret = execDBUpdate(sb.toString());
            //sqlPut(AdminPanel, sb.toString());
            //waitForIt(AdminWait);
        }
        if(sb2 != null) {
            if(debug) logger.log(Level.INFO,"admChgFocusLost: sending insert: {0}",sb2.toString());
            AdminWait.setEnabled(true);
            AdminWait.setVisible(true);
            int ret = execDBUpdate(sb2.toString());
            if(ret < 0 || ret > 1) {
                logger.log(Level.WARNING,"unexpected ret code to admin save: {0}",ret);
            }
            //sqlPut(AdminPanel, sb2.toString());
            //waitForIt(AdminWait);
        }
        StringBuffer sb3 = new StringBuffer();
        sb3.append("select * from "+tbls+";");
        HashMap[] rets = getDBData(sb3.toString());
        if(rets.length > 0) {
            if(rets[0].size() >= 3) {
                ContestName.setText((String)rets[0].get("showname"));
                ShowDate.setText(((String)rets[0].get("showdate")).replaceAll("~",","));
                ShowLocation.setText((String)rets[0].get("location"));
                CurrentCarShowName = (String)rets[0].get("showname");
                CarShowDate = (String)rets[0].get("showdate");
            }
        }
    }//GEN-LAST:event_SaveAdminActionPerformed

    private void EntrantDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EntrantDeleteActionPerformed
        if(!EntrantNumber.getText().equals("")) {
            String tble;
            String tbls;
            String tblsp;
            if(winHost) {
                tble = CarShowConstants.winEntrants; 
                tbls = CarShowConstants.winScoring;
                tblsp = CarShowConstants.winSpecials;
            }
            else {
                tble = CarShowConstants.Entrants;
                tbls = CarShowConstants.Scoring;
                tblsp = CarShowConstants.Specials;
            }
            if(evt.getActionCommand().equals("Confirm")) {
                EntrantDeleteButton.setText("Delete");
                EntrantDeleteButton.setForeground(java.awt.Color.GRAY);
                String oldEntrant = EntrantNumber.getText();
                // remove from entrants table
                String request = "delete from "+tble+""
                        + " where entrant_num = "+oldEntrant+";";
                regWait.setEnabled(true);
                regWait.setVisible(true);
                int ret = execDBUpdate(request);
                //remove from scoring table
                request = "delete from "+tbls+" where "+
                   "entrant_num = "+oldEntrant+";";
                regWait.setEnabled(true);
                regWait.setVisible(true);
                ret = execDBUpdate(request);
                // remove any special awards
                request = "delete from "+tblsp+"where "+
                    "entrant_num = "+oldEntrant+";";
                ret = execDBUpdate(request);
                // attempt to reclaim the lost entrant number if at end of group
                execDBUpdate("alter table "+tble+" auto_increment=1;");
            }
            else {
                EntrantDeleteButton.setForeground(java.awt.Color.RED);
                EntrantDeleteButton.setText("Confirm");
                EntrantDeleteButton.requestFocus();
            }
        }
    }//GEN-LAST:event_EntrantDeleteActionPerformed

    /**
     * Action performed block for Administration panel save server name/login
     * values.
     * @param evt 
     */
    private void ServerSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ServerSaveButtonActionPerformed
        boolean changed = false;
        if (ScoringServerName.getText().equals("")) {
            if(this.preferences.getServer() != null)
                ScoringServerName.setText(this.preferences.getServer());
            else ScoringServerName.setText(CarShowConstants.defaultServer);
            changed = true; // dont know what it was before but empty is right out
        }
        else if(ScoringServerName.getText().equals(SQLServer)) {
            changed = false;
        }
        else if(ScoringServerName.getText().equals(CarShowConstants.defaultServer)) {
            changed = true;
        }
        else if(ScoringServerName.getText()
            .matches("[0-9]{2,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?")) {
            SQLServer = ScoringServerName.getText().trim();
            changed = true;
        }
        else {
            SQLServer = ScoringServerName.getText();
        }
        if(ServerUserID.getText().equals("")) {
            JOptionPane.showMessageDialog(tabbedPane,
              "Server User ID is unset.",
              "Show Data", JOptionPane.ERROR_MESSAGE);
            ServerUserID.requestFocus();
            return;
        }
        else if(!ServerUser.equals(ServerUserID.getText())) {
            ServerUser = ServerUserID.getText();
            changed = true;
        }
        if (ServerPassword.getText().equals("")) {
           JOptionPane.showMessageDialog(tabbedPane,
              "Server User Password is unset.",
              "Show Data", JOptionPane.ERROR_MESSAGE);
            ServerPassword.requestFocus();
            return;
        }
        else if(!UserPassword.equals(ServerPassword.getText())) {
            UserPassword = ServerPassword.getText();
            changed = true;
        }

        if (changed) {
            disconnect();
            String oServer = SQLServer;
            String oUser = ServerUser;
            String oPass = UserPassword;
            SQLServer = ScoringServerName.getText();
            ServerUser = ServerUserID.getText();
            UserPassword = ServerPassword.getText();
            if(!checkConnection()) {
                JOptionPane.showMessageDialog(tabbedPane,
                "Scoring Server "+ScoringServerName.getText() +
                " does not respond to a test connection verify the "+
                "server name and userid/password settings supplied",
                "No Response", JOptionPane.ERROR_MESSAGE);
                SQLServer = oServer;
                ServerUser = oUser;
                UserPassword = oPass;
                ScoringServerName.requestFocus();
                return;
            } else {
                clearLocalTables();
                connect();
                getAdminData();
                ScoringServerName.setBackground(Color.GREEN);
                // Save these new values in the preferences.xml data
                if(this.preferences != null) {
                    this.preferences.setServer(SQLServer);
                    this.preferences.setUsername(ServerUser);
                    this.preferences.setPassword(UserPassword);
                    savePreferences();
                }
                if(this.SQLServer.equals("localhost") || this.SQLServer.equals(getLocalIP())) {
                    ResetEntrantDataButton.setVisible(true);
                    ResetEntrantLabel.setVisible(true);
                    ArchiveEntrantDataButton.setVisible(true);
                    ArchiveEntrantLabel.setVisible(true);
                }
                else {
                    ResetEntrantDataButton.setVisible(false);
                    ResetEntrantLabel.setVisible(false);
                    ArchiveEntrantDataButton.setVisible(false);
                    ArchiveEntrantLabel.setVisible(false);
                }
            }
        }
        if(debug) logger.log(Level.INFO,"ServerSaveBtnActPerf: on exit ScoringServerName: {0}",SQLServer);
    }//GEN-LAST:event_ServerSaveButtonActionPerformed

    private void resetEntrantData(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetEntrantData
        int a = JOptionPane.showConfirmDialog(tabbedPane,"This will reset all entrant data"
                +" and start a new show, do you want to proceed?","Reset Show Entrants Data", 
                JOptionPane.OK_CANCEL_OPTION);
        if(a == JOptionPane.OK_OPTION) {
            if(!resetShow()) {
                JOptionPane.showMessageDialog(tabbedPane,"Reset Failed","Show Reset Result",
                    JOptionPane.ERROR_MESSAGE);
            }
            JOptionPane.showMessageDialog(tabbedPane,"Reset Complete","Show Reset Result",
                JOptionPane.INFORMATION_MESSAGE);
        }
    }//GEN-LAST:event_resetEntrantData

    private void archiveEntrants(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_archiveEntrants
        int a = JOptionPane.showConfirmDialog(tabbedPane,"This will archive the entrant data"
                +" of the current show, do you want to proceed?","Archive Show Entrant Data", 
                JOptionPane.OK_CANCEL_OPTION);
        if(a == JOptionPane.OK_OPTION) {
            boolean addresult = true;
            HashMap[] rs = getDBData(CarShowConstants.GetAllEntrants);
            HashMap[] currArchive = getDBData(CarShowConstants.GetArchivedEntrants);
            if(rs.length > 0) {
                top:
                for(int k = 0; k < rs.length; k++) { // k = # of entrants (rows)
                    // check each row if entrant is already archived
                    // must loop over every entrant already in table for
                    // each entrant of current show
                    // This will be a very slow b/c we search rs.size times
                    // across currArchive.size (rs.size * currArchive.size)
                    boolean present = false;
                    for(int g = 0; g < currArchive.length; g++) {
                        java.util.Collection archiveValue = currArchive[g].values();
                        java.util.Collection addValue = rs[k].values();
                        if(archiveValue.containsAll(addValue)) {
                            present = true;
                            break;
                        }
                    }
                    if (!present) {
                        java.util.Set keyset = rs[k].keySet();
                        Iterator it = keyset.iterator();
                        StringBuilder sb = new StringBuilder();
                        sb.append("insert into "+CarShowConstants.ArchiveData+" ");
                        sb.append("set ");
                        boolean first = true;
                        while(it.hasNext()) {
                            if(!first) {
                                sb.append(", ");
                            }
                            else first = false;
                            String colkey = (String)it.next();
                            sb.append(colkey+"=\""+rs[k].get(colkey)+"\"");
                        }
                        sb.append(";");
                        if(debug) System.out.println("achiveEntrants SQL: "+sb.toString());
                         boolean addret= (execDBUpdate(sb.toString()) > 0) ? true : false;
                        addresult &= addret;
                    }
                }
            }
            if(!addresult) {
                JOptionPane.showMessageDialog(tabbedPane,
                    "Archive Save reports a failure occurred.!","Archive Result",
                    JOptionPane.INFORMATION_MESSAGE);
            }
            else {
                JOptionPane.showMessageDialog(tabbedPane,
                    "Archive Complete","Archive Result",
                    JOptionPane.INFORMATION_MESSAGE); 
            }
        }
    }//GEN-LAST:event_archiveEntrants

    private void ArchiveSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ArchiveSearchActionPerformed
        String fname = FirstName.getText();
        String lname = LastName.getText();
        boolean clause = false;
        if(fname != null & lname != null) {
            StringBuilder query = new StringBuilder();
            query.append("SELECT fname,lname,address,city,state,zip,phone,club from ");
            query.append(CarShowConstants.ArchiveData+" where ");
            if(fname.length() > 0) {
                query.append("lower(fname) like lower(\""+fname+"%\")");
                clause = true;
                if(lname.length() > 0) query.append(" and ");
            }
            if(lname.length() > 0) {
                query.append("lower(lname) like lower(\""+lname+"%\")");
                clause = true;
            }
            //String query = "SELECT fname,lname,address,city,state,zip,phone from "+
            //    CarShowConstants.Entrants+" where lower(fname) like lower(\""+fname+
            //    "\") and lower(lname) like lower(\""+lname+"\");";
            HashMap[] rs = null;
            String[] keys = {"fname","lname","address","city","state","zip","phone","club"};

            if(clause)
                rs = getDBData(query.toString());
            if(rs != null && rs.length > 0) {
                if(rs.length > 1) {
                    // Multi-entry returned, possible for common names e.g. Bob Jones
                    // reformat HashMap rows into array of comma separated strings
                    // and put into a EntrantSearchResults frame
                    String[] items = new String[rs.length];
                    StringBuffer sb;
                    for(int i = 0; i < rs.length; i++) {
                        sb = new StringBuffer();
                        for(int k = 0; k < keys.length; k++) {
                            sb.append(rs[i].get(keys[k]));
                            if(k < keys.length-1) sb.append(",");
                        }
                        items[i] = sb.toString();
                    }
                    // items[] now has comma separated rows data from search
                    setMultiArchiveEntrant(items);
                    //EntrantSearchResults esr = new EntrantSearchResults();
                    //esr.
                }
                else if(rs.length == 1) { // Single entry returned
                    StringBuilder sb = new StringBuilder();
                    for(int i = 0; i < keys.length; i++) {
                        sb.append(rs[0].get(keys[i]));
                        if(i < keys.length-1) sb.append(",");
                    }
                    setArchiveEntrant(sb.toString());
                }
                else {
                    clearEntrant();
                    FirstName.requestFocus();
                }
            }
            else {
                clearEntrant();
                FirstName.requestFocus();
            }
        }
    }//GEN-LAST:event_ArchiveSearchActionPerformed

    private void EntrantNumberFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_EntrantNumberFocusGained
        if(!EntrantNumber.getText().equals("")) {
            //logger.log(Level.INFO,"EntNumFocusGain: clearing EntNum field");
            RegPrint.setForeground(oldPrintColor);
            //RegPrint.setEnabled(false);
            
            //EntrantNumber.setText("");
        }
    }//GEN-LAST:event_EntrantNumberFocusGained

    /**
    * @param args no arguments are currently supported, future may support
     * selection of remote system name/ip-addr, database filename
    */
    public static void main(String args[]) throws InterruptedException, InvocationTargetException {
        // Using a invokeLater constuct will allow putting a splash page
        // up during loading of the app, although we still need some graphics
        // to put onto that splash page before we can implement it.
        Splash sp = null;
        sp = new Splash();
        
        //java.awt.EventQueue.invokeLater(new Runnable() {
        java.awt.EventQueue.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                CarShowUI cs = new CarShowUI();
                
                cs.setVisible(true);
            }
        });
        sp.remove();
    }
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AddClassButton;
    private javax.swing.JButton AddEntrant;
    private javax.swing.JLabel AddrLabel;
    private javax.swing.JPanel AdminPanel;
    public java.awt.Label AdminWait;
    private javax.swing.JButton ArchiveEntrantDataButton;
    private javax.swing.JLabel ArchiveEntrantLabel;
    private javax.swing.JButton ArchiveSearchButton;
    private javax.swing.JCheckBox Award10Box;
    private javax.swing.JCheckBox Award11Box;
    private javax.swing.JCheckBox Award12Box;
    private javax.swing.JCheckBox Award13Box;
    private javax.swing.JCheckBox Award14Box;
    private javax.swing.JCheckBox Award15Box;
    private javax.swing.JCheckBox Award16Box;
    private javax.swing.JCheckBox Award1Box;
    private javax.swing.JCheckBox Award2Box;
    private javax.swing.JCheckBox Award3Box;
    private javax.swing.JCheckBox Award4Box;
    private javax.swing.JCheckBox Award5Box;
    private javax.swing.JCheckBox Award6Box;
    private javax.swing.JCheckBox Award7Box;
    private javax.swing.JCheckBox Award8Box;
    private javax.swing.JCheckBox Award9Box;
    private javax.swing.JScrollPane AwardsPane;
    private javax.swing.JPanel AwardsPanel;
    private javax.swing.JButton AwardsPrintButton;
    private javax.swing.JButton AwardsSaveResultsButton;
    public java.awt.Label AwardsWait;
    private javax.swing.JLabel BodyMxPtsLabel1;
    private javax.swing.JLabel BodyMxPtsLabel2;
    private javax.swing.JLabel BodyScoreLabel1;
    private javax.swing.JLabel BodyScoreLabel2;
    private javax.swing.JTable CarScores;
    private javax.swing.JLabel ChassisMxPtsLabel1;
    private javax.swing.JLabel ChassisMxPtsLabel2;
    private javax.swing.JLabel ChassisScoreLabel1;
    private javax.swing.JLabel ChassisScoreLabel2;
    private javax.swing.JLabel CityLabel;
    private javax.swing.JLabel ClassLabel;
    private javax.swing.JLabel ClassLabel1;
    private javax.swing.JScrollPane ClassListPanel;
    public javax.swing.JTable ClassListTable;
    private javax.swing.JLabel ClassMnemonicLabel;
    private javax.swing.JLabel ClassNameLabel;
    private javax.swing.JPanel ClassSetPanel;
    public java.awt.Label ClassWait;
    private javax.swing.JLabel ColorLabel;
    private javax.swing.JTextField ContestName;
    private javax.swing.JLabel ContestNameLabel;
    private javax.swing.JButton DeleteClassButton;
    private javax.swing.JLabel EndYearLabel;
    private javax.swing.JLabel EngineMxPtsLabel1;
    private javax.swing.JLabel EngineMxPtsLabel2;
    private javax.swing.JLabel EngineScoreLabel1;
    private javax.swing.JLabel EngineScoreLabel2;
    private javax.swing.JTextField EntrantAddress;
    private javax.swing.JTextField EntrantCity;
    public javax.swing.JComboBox EntrantClass;
    private javax.swing.JButton EntrantClear;
    public javax.swing.JComboBox EntrantClub;
    private javax.swing.JTextField EntrantColor;
    private javax.swing.JButton EntrantDeleteButton;
    private javax.swing.JTextField EntrantMake;
    private javax.swing.JTextField EntrantModel;
    private javax.swing.JTextField EntrantNumber;
    private javax.swing.JTextField EntrantParking;
    private javax.swing.JTextField EntrantPhone;
    private javax.swing.JButton EntrantSearch;
    private javax.swing.JTextField EntrantState;
    private javax.swing.JTextField EntrantYear;
    private javax.swing.JTextField EntrantZipCode;
    private javax.swing.JLabel EntryNumLabel;
    private javax.swing.JLabel EntryNumLabel2;
    private javax.swing.JTextField FirstName;
    private javax.swing.JLabel FirstNameLabel;
    private javax.swing.JLabel HostClubName;
    private javax.swing.JLabel IPAddrLabel;
    private javax.swing.JLabel InteriorMxPtsLabel1;
    private javax.swing.JLabel InteriorMxPtsLabel2;
    private javax.swing.JLabel InteriorScoreLabel1;
    private javax.swing.JLabel InteriorScoreLabel2;
    private javax.swing.JLabel JSColorLabel;
    private javax.swing.JTextField JS_BodyScore1;
    private javax.swing.JTextField JS_BodyScore2;
    private javax.swing.JTextField JS_ChassisScore1;
    private javax.swing.JTextField JS_ChassisScore2;
    private javax.swing.JTextField JS_EngineScore1;
    private javax.swing.JTextField JS_EngineScore2;
    private javax.swing.JTextField JS_EntrantClass;
    private javax.swing.JTextField JS_EntrantColor;
    public javax.swing.JTextField JS_EntrantMake;
    public javax.swing.JTextField JS_EntrantModel;
    private javax.swing.JTextField JS_EntrantNumber;
    private javax.swing.JTextField JS_EntrantYear;
    private javax.swing.JTextField JS_InteriorScore1;
    private javax.swing.JTextField JS_InteriorScore2;
    private javax.swing.JTextField JS_JudgeInitials1;
    private javax.swing.JTextField JS_JudgeInitials2;
    private javax.swing.JLabel JS_ParkingNumLabel;
    public javax.swing.JTextField JS_ParkingNumber;
    private javax.swing.JButton JS_SaveButton;
    private javax.swing.JTextField JS_TireScore1;
    private javax.swing.JTextField JS_TireScore2;
    private javax.swing.JTextField JS_WheelsScore1;
    private javax.swing.JTextField JS_WheelsScore2;
    private javax.swing.JLabel JudgeInitialsLabel1;
    private javax.swing.JLabel JudgeIntialsLabel2;
    private javax.swing.JPanel JudgeSheetPanel;
    private javax.swing.JPanel JudgeSheetSubPanel;
    private javax.swing.JScrollPane JudgingPane;
    private javax.swing.JPanel JudgingPanel;
    public java.awt.Label JudgingWait;
    private javax.swing.JTextField LastName;
    private javax.swing.JLabel LastNameLabel;
    private javax.swing.JLabel MakeLabel;
    private javax.swing.JLabel MakeLabel1;
    private javax.swing.JLabel ModelLabel;
    private javax.swing.JLabel ModelLabel1;
    private javax.swing.JLabel ModelLabel2;
    private javax.swing.JTextField MostClubMembers;
    private javax.swing.JLabel MostClubsLabel;
    private javax.swing.JTextField NewClassEndYear;
    private javax.swing.JTextField NewClassMnemonic;
    private javax.swing.JTextField NewClassName;
    private javax.swing.JTextField NewClassStartYear;
    private javax.swing.JLabel ParkingNumLabel;
    private javax.swing.JLabel PhoneLabel;
    private javax.swing.JButton RegPrint;
    private javax.swing.ButtonGroup RegStatusButtonGroup;
    public javax.swing.JPanel RegistrationPanel;
    private javax.swing.JTable ReportTable;
    private javax.swing.JButton ResetEntrantDataButton;
    private javax.swing.JLabel ResetEntrantLabel;
    private javax.swing.JTextField ScoringServerName;
    private javax.swing.JTextField SecondMostClub;
    private javax.swing.JLabel ServerNameLabel;
    private javax.swing.JTextField ServerPassword;
    private javax.swing.JButton ServerSaveButton;
    private javax.swing.JTextField ServerUserID;
    private javax.swing.JTextField ShowDate;
    private javax.swing.JLabel ShowDateLabel;
    private javax.swing.JTextField ShowLocation;
    private javax.swing.JLabel ShowLocationLabel;
    private javax.swing.JLabel StartYearLabel;
    private javax.swing.JLabel StateLabel;
    private javax.swing.JLabel TiresMxPtsLabel1;
    private javax.swing.JLabel TiresMxPtsLabel2;
    private javax.swing.JLabel TiresScoreLabel1;
    private javax.swing.JLabel TiresScoreLabel2;
    private javax.swing.JLabel WheelsMxPtsLabel1;
    private javax.swing.JLabel WheelsMxPtsLabel2;
    private javax.swing.JLabel WheelsScoreLabel1;
    private javax.swing.JLabel WheelsScoreLabel2;
    private javax.swing.JLabel YearLabel;
    private javax.swing.JLabel YearLabel1;
    private javax.swing.JLabel ZipLabel;
    private javax.swing.JToggleButton debugButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    public java.awt.Label judgingSheetWait;
    public java.awt.Label regWait;
    private javax.swing.JLabel specialtyAwardsLabel;
    public javax.swing.JTabbedPane tabbedPane;
    private javax.swing.JPanel wrapperPanel;
    // End of variables declaration//GEN-END:variables


    /**
     * Schedule the judgingReport() method on a periodic (2 sec.) timer.
     * This give the refresh capability to the judging report panel and
     * allows tabbed panel changes to stop the timer when a different tab
     * has been selected.
     */
    private void schedReport() {
         
        //Report_scheduler
         
        rptPoll = true;
        rptActionListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                if(rptPoll)
                judgingReport();
            }
        };    
        rTimer = new javax.swing.Timer(CarShowConstants.ReportRefreshRate, rptActionListener);
        rTimer.start();    
        if(debug) logger.log(Level.INFO,
            " judging panel timer started");
    }
    /**
     * judgingReport - cycles on a periodic viewing the judging records
     * It requests a multi-record SQL query (a set of CSV lines, one for each
     * entrant).  The reply path from the SQLClientReader service will come
     * through the setJudgePanel() method to populate the Judging panel.
     * Periodic refresh rate (cycle rate) is set by the constant
     * {@link CarShowConstants.ReportRefreshRate howConstants.ReportRefreshRate}.
     */
    
    private void judgingReport() {
        String tble;
        String tbls;
        if(winHost) {
            tble = CarShowConstants.winEntrants;
            tbls = CarShowConstants.winScoring;
        }
        else {
            tble = CarShowConstants.Entrants;
            tbls = CarShowConstants.Scoring;
        }
        JudgingWait.setEnabled(true);
        JudgingWait.setVisible(true);
        String entRequest = "select "+tble+".entrant_num, "+tble+".mnemonic,"+
            " "+tble+".fname, "+tble+".lname, "+tble+".year, "+tble+".make, "+
            ""+tble+".model, "+tbls+".Judge1, "+tbls+".j1_total, "+tbls+".Judge2,"+
            tbls+".j2_total, "+tble+".printed from "+tble+
            " join "+tbls+
            " where "+tbls+".entrant_num="+tble+".entrant_num"+
            " order by "+tbls+".Judge1 like \"\", "+tbls+".Judge2 like \"\","+
            tbls+".j1_total, "+tbls+".j2_total desc;";
        //sqlGet(JudgingPanel, entRequest);
        //waitForIt(JudgingWait);
        HashMap[] rs = getDBData(entRequest);
        //setJudgingData(rs);
        if(rs.length > 0) setJudgePanel(rs);
        JudgingWait.setEnabled(false);
        JudgingWait.setVisible(false);
    }

    /**
     * Get the data from the DB for the Awards Report panel.
     */
    private void getAwardsReport() {
        // this gets the current club participation counts
        // chooses the top 2 clubs & their counts from the DB
        String tbl;
        if(winHost) tbl = CarShowConstants.winEntrants;
        else tbl = CarShowConstants.Entrants;
        String request = "select club, count(*) as cnt from "+tbl+
            " where club!=\"\" group by club order by cnt desc, entrant_num asc limit 2;";
        AwardsWait.setEnabled(true);
        AwardsWait.setVisible(true);
        //sqlGet(MostClubMembers,request);
        //waitForIt(AwardsWait);
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) setClubAward(rs);
        AwardsWait.setEnabled(false);
        AwardsWait.setVisible(false);
        /* THIS query gets a list ordered the way we want excepting the
         * awards exclusions.
         * 
           select Entrants.entrant_num, Entrants.mnemonic, Entrants.fname, 
           Entrants.lname, Entrants.year, Entrants.make, Entrants.model, 
           Scoring.j1_total, Scoring.j2_total, Entrants.aw1, Entrants.aw2 
           from Entrants natural join Scoring where Entrants.entrant_num=Scoring.entrant_num
           order by LENGTH(Entrants.mnemonic) asc, Entrants.mnemonic, ((j1_total+j2_total)/2) asc, Entrants.entrant_num desc;
         * 
         * If no query can be developed that will exclude these award holding
         * rows, the reply path will need to collect them and put them up into
         * the display in the correct place in the screens (which may be the
         * only way given the strange rules of the Participants Choice
         * award.
         * 
         * 4/29/12 - added columns color & class_desc to request for conformance with
         * changed requirement per DTO - wm
         * 4/29/12 changed query to enforce tie-breaking by registration number
         * order (lowest reg # wins ties) per DTO -wm
         */
        String tble;
        String tbls;
        String tblj;
        if(winHost) {
            tble = CarShowConstants.winEntrants;
            tbls = CarShowConstants.winScoring;
            tblj = CarShowConstants.winJudgeClasses;
        }
        else {
            tble = CarShowConstants.Entrants;
            tbls = CarShowConstants.Scoring;
            tblj = CarShowConstants.JudgeClasses;
        } 
        // Note that the query will return the search in reverse order
        // this gets reversed when we build the array of Hash Map objects
        // containing DB data
        request = "select "+tble+".entrant_num, "+tble+".mnemonic, "+
            tblj+".classname, "+tble+".fname, "+tble+".lname, "+
            tble+".year, "+tble+".color, "+tble+".make, "+tble+".model, "+
            tbls+".j1_total, "+tbls+".j2_total, "+tble+".aw1, "+tble+".aw2 from "+
            tble+" join "+tbls+
            " join "+tblj+
            " where "+tble+".entrant_num = "+tbls+".entrant_num and "+
            ""+tble+".mnemonic = "+tblj+".mnemonic "+
            "order by LENGTH("+tble+".mnemonic) desc, "+tble+".mnemonic desc, ("+
            tbls+".j1_total + "+tbls+".j2_total) asc, "+
            tble+".entrant_num desc;";
        AwardsWait.setEnabled(true);
        AwardsWait.setVisible(true);
        //sqlGet(AwardsPanel,request);
        //waitForIt(AwardsWait);
        System.out.println("Sending: "+request);
        rs = getDBData(request);
        if(rs.length > 0) setAwardsPanel(rs);
        AwardsWait.setEnabled(false);
        AwardsWait.setVisible(false);
    }
    
    /**
     * set the values on the awards report panel (ReportTable JTable object)
     * using the HashMap array of values from the DB request.
     * @param args HashMap array, one hash map for each entrant record
     * 
     * Here is where we evaluate if an award states within the Awards
     * preferences.  CanShare flag means we can share the award with another
     * award, the CanPlace flag indicates the award is allowed to be part of
     * the scoring (typically winning an award would preclude winning a trophy
     * in the scoring group for that class.
     */
    // Each HashMap in the array contains these keys from sql query:
    // entrant_num, mnemonic, classname, fname, lname, year, color, make, model, j1_total, j2_total, aw1, aw2
    void setAwardsPanel(HashMap[] args) {
        setSpecialAwards();
        String lastClassSeen = null;
        int winnersIdx = 0;
        String[][] awardWinners = new String[16][8]; // 16 Awards fields, 8 values wide for display fields
        java.util.HashMap<String, String> awardMap = new java.util.HashMap();
        javax.swing.table.DefaultTableModel dm = (javax.swing.table.DefaultTableModel)ReportTable.getModel();
        dm.getDataVector().removeAllElements();
        boolean padded = false;
        for(int i = 0; i < args.length; i++) {
            HashMap entry = args[i];
            if(lastClassSeen == null) lastClassSeen = (String)entry.get("mnemonic");
            // Skip display of the PRE-registered class members in the report
            else if(((String)entry.get("mnemonic")).equals("PRE")) continue;
            else {
                if(!lastClassSeen.equals(entry.get("mnemonic"))) { // HANDLE PRINTED CLASS SEPARATOR
                    Object[] o = new Object[1];
                    if(!padded) { // if inter-class pad row isn't there yet
                        dm.addRow(o); // print it to the display
                        padded = true; // only print one btwn classes
                    }
                    lastClassSeen = (String)entry.get("mnemonic");
                }
            }
            // now repack into report table cols, concat 2&3, strip 10 & 11
            String[] dvals = new String[8];
            dvals[0] = (String)entry.get("entrant_num"); // reg #
            dvals[1] = (String)entry.get("mnemonic")+" "+(String)entry.get("classname");
            dvals[2] = (String)entry.get("fname")+"  "+entry.get("lname");
            dvals[3] = (String)entry.get("year"); // year
            dvals[4] = (String)entry.get("color"); // color
            dvals[5] = (String)entry.get("make"); // make
            dvals[6] = (String)entry.get("model"); // model
            // cover unset score/unscored data cases
            if(entry.get("j1_total") == null || entry.get("j1_total").equals("null") || entry.get("j1_total").equals("")) {
                entry.put("j1_total","0");
            }
            if(entry.get("j2_total") == null || entry.get("j2_total").equals("null") || entry.get("j2_total").equals("")) {
                entry.put("j2_total","0");
            }
            int score = (Integer.parseInt((String)entry.get("j1_total"))+
                Integer.parseInt((String)entry.get("j2_total")));
            dvals[7] = new Integer(score).toString();
            // now handle the awards winners, only those awards with
            // the 'carshare' bit set in the Awards preferences get to
            // be added to the dm (default table model of the award report table)
            // other award winners get stashed, put at end of list (awardMap object)
            // THIS ALL NEEDS TO ALSO TAKE INTO ACCOUNT THE NEW
            // DB FIELD canplace WHICH WILL DESCRIBE WHETHER THE
            // AWARD CAN PLACE IN THE CAR SHOW
            if(entry.get("aw1") != null && !entry.get("aw1").equals("") && !entry.get("aw1").equals("null")) {
                // if ParticipantsChoice, display in order & save it
                String aw1 = (String)entry.get("aw1");
                String aw2 = (String)entry.get("aw2"); // cover two awards case
                // Validate against the Special Awards & AwardsShared
                // reflecting the special awards table info (Specials table)

                if(SpecialAwards.containsKey(aw1) && SpecialAwards.get(aw1).equals(entry.get("entrant_num")) ||
                        SpecialAwards.containsKey(aw2) && SpecialAwards.get(aw2).equals(entry.get("entrant_num"))) {
                    boolean added = false;
                    // handle shareable award in aw1 treat as allowed
                    if(AwardsShared.containsKey(aw1)) {
                        if(AwardsShared.get(aw1).equals("1")) {
                            dm.addRow(dvals);
                            padded = false;
                            added = true;
                            String[] nvals = new String[8];
                            System.arraycopy(dvals,0,nvals,0,dvals.length);
                            nvals[0] = aw1;
                            System.arraycopy(nvals,0,awardWinners[winnersIdx++],0, dvals.length);
                        }
                        else {
                            dvals[0] = aw1;
                            System.arraycopy(dvals,0,awardWinners[winnersIdx++],0, dvals.length);
                            awardMap.put((String)entry.get("entrant_num"),(String)entry.get("aw1"));
                        }
                    }
                    if(aw2 != null && aw2.length() > 0) { // case of two awards e.g. can-share
                        if(SpecialAwards.get(aw2).equals(entry.get("entrant_num"))) {
                            if(AwardsShared.containsKey(aw2)) {
                                if(!added && AwardsShared.get(aw2).equals("1") && // both, if only one
                                        AwardsShared.get(aw1).equals("1")) { // it doesnt count
                                    // && AwardsPlace.get(aw1).equals("1") // TODO:
                                    dm.addRow(dvals);
                                    padded = false;            
                                    String[] nvals = new String[8];
                                    System.arraycopy(dvals,0,nvals,0,dvals.length);
                                    nvals[0] = aw2;
                                    System.arraycopy(nvals,0,awardWinners[winnersIdx++],0, dvals.length);
                                }
                                else { // save for later Awards table data
                                    dvals[0] = aw2;
                                    System.arraycopy(dvals,0,awardWinners[winnersIdx++],0, dvals.length);
                                    awardMap.put((String)entry.get("entrant_num"),(String)entry.get("aw2"));
                                }
                            }
                        }
                    }
                }
                else {
                    logger.log(Level.WARNING,"Ent# mismatch SpecialAwards and Entrants (aw1,aw2) for {0}: {1},{2}",
                        new Object[] {entry.get("entrant_num"), entry.get("aw1"),entry.get("aw2")});
                }
            }
            else {
                dm.addRow(dvals);
                padded = false;
            }
            // fix dynamic column widths by col# in table for Class
            // this selects the max of (current,new-row-name_field-text.length)

            javax.swing.table.TableColumn tc = ReportTable.getColumnModel().getColumn(2);
            tc.setPreferredWidth(java.lang.Math.max(tc.getWidth(),dvals[1].length()));
            // adjust to ensure whole name fld displays
            tc = ReportTable.getColumnModel().getColumn(2);
            tc.setPreferredWidth(java.lang.Math.max(tc.getWidth(),dvals[2].length()));
        } // end for loop over array of award table entries/scores
        //now add the awardWinners rows, if any found
        if(winnersIdx > 0) {
            java.util.Vector<String> vect = new java.util.Vector();
            java.util.Vector<String> vect2 = new java.util.Vector();
            vect.add("Award");
            dm.addRow(vect);
            vect2.add("Winners");
            dm.addRow(vect2);
        }
        for(int k = 0; k < winnersIdx; k++) {
            if(awardWinners[k][0] != null) { // check if slot is used
                // This all changed with the new model, I'm assuming that
                // the share-ability of an award connotes inclusion in
                // the class ranking above, everything in awardWinners is
                // pre-vetted for display with award name first
                dm.addRow(awardWinners[k]);
            }
        }
        this.ReportTable.doLayout();
    }
    
    /**
     * set the values on the Awards Report panel of the UI.  This is the
     * reply path from SqlClientReader() when the Awards report is requested.
     */
    @Deprecated
    void setAwardsPanel(String[] args) {
        // save award winners for later handling in this array
        java.util.HashMap<String, String> awardMap = new java.util.HashMap();
        String[][] awardWinners = new String[7][8]; // 6 majors + participantsChoice
        String lastClassSeen = null;
        int winnersIdx = 0;
        if(debug) logger.log(Level.INFO, "setAwardsPanel: args cnt: {0}", args.length);
        if(args != null && args.length > 0) {
            if(args.length == 1 && !args[0].contains(",")) {
                if(debug) logger.log(Level.INFO,
                    "Ret code or not data SQL from Awards request: {0}", args[0]);
            }
            else { // typical return path with multiple rows to display
                //String[] nargs = breakTies(args);
                javax.swing.table.DefaultTableModel dm = (javax.swing.table.DefaultTableModel)ReportTable.getModel();
                dm.getDataVector().removeAllElements();
                for(int i = 0; i < args.length; i++) {
                    String entry = args[i];
                    String[] vals = entry.split(",");
                    if(vals.length < 13) {
                        if(debug) logger.log(Level.INFO, "too few cols {0} expanding...", vals.length);
                        
                        String[] nvals = new String[13];
                        System.arraycopy(vals, 0, nvals, 0, vals.length);
                        for(int a = vals.length; a < nvals.length; a++)
                            nvals[a] = "";
                        vals = nvals;
                    }
                    if(lastClassSeen == null) lastClassSeen = vals[1];
                    else {
                        if(!lastClassSeen.equals(vals[1])) { // handle class separation
                            Object[] o = new Object[1];
                            dm.addRow(o);
                            lastClassSeen = vals[1];
                        }
                    }
                    // now repack into report table cols, concat 2&3, strip 10 & 11
                    String[] dvals = new String[8];
                    dvals[0] = vals[0]; // reg #
                    dvals[1] = vals[1]+" "+vals[2]; // mnemonic+classname
                    dvals[2] = vals[3]+" "+vals[4]; // fname+lname
                    dvals[3] = vals[5]; // year
                    dvals[4] = vals[6]; // color
                    dvals[5] = vals[7]; // make
                    dvals[6] = vals[8]; // model
                    if(vals[9].equals("null") || vals[9].equals("")) {
                        vals[9] = "0";
                    }
                    if(vals[10].equals("null") || vals[10].equals("")) {
                        vals[10] = "0";
                    }
                    int score = (Integer.parseInt(vals[9]) + Integer.parseInt(vals[10]));
                    dvals[7] = new Integer(score).toString();
                    // now handle the awards winners, only participants choice
                    // will populate into awards groups in top of table
                    // other award winners get stashed, put at end of list
                    if(!vals[11].equals("") && !vals[11].equals("null")) {
                        // if ParticipantsChoice, display in order & save it
                        if(vals[11].equals("ParticipantChoiceBox")) {
                            dm.addRow(dvals);
                        } // corrupt data handler...
                        if(vals[11].matches("\\S+Box")) {
                            System.arraycopy(dvals,0,awardWinners[winnersIdx++],0, dvals.length);
                            awardMap.put(vals[0],vals[11]); 
                        }
                    }
                    else {
                        dm.addRow(dvals);
                    }
                    // fix dynamic column widths by col# in table for Class
                    // this selects the max of (current,new-row-class-text.length)
                    javax.swing.table.TableColumn tc = ReportTable.getColumnModel().getColumn(1);
                    tc.setPreferredWidth(java.lang.Math.max(tc.getWidth(),dvals[1].length()));
                    // adjust to ensure whole name fld displays
                    tc = ReportTable.getColumnModel().getColumn(2);
                    tc.setPreferredWidth(java.lang.Math.max(tc.getWidth(),dvals[2].length()));
                } // end for loop, now add the awardWinners rows...
                java.util.Vector<String> vect = new java.util.Vector();
                java.util.Vector<String> vect2 = new java.util.Vector();
                vect.add("Award");
                dm.addRow(vect);
                vect2.add("Winners");
                dm.addRow(vect2); // I tried reusing the vector & it didn't work
                for(int k = 0; k < winnersIdx; k++) {
                    if(awardWinners[k][0] != null) { // check if slot is used
                        // find the special award for this entrant
                        // since we've lost it after we parsed the raw sql data
                        // put the special award name into the entrant # field
                        if(awardMap.containsKey(awardWinners[k][0])) {
                            if(debug) logger.log(Level.INFO, "patching {0}with {1}",
                                new Object[]{awardWinners[k][0], awardMap.get(awardWinners[k][0])});
                            awardWinners[k][0]=awardMap.get(awardWinners[k][0]).replaceAll("Box","");
                        }
                        dm.addRow(awardWinners[k]);
                    }
                }
                // finally add the club award winners
                if(!MostClubMembers.getText().equals("")) {
                    java.util.Vector<String> vect3 = new java.util.Vector();
                    java.util.Vector<String> vect3a = new java.util.Vector();
                    java.util.Vector<String> vect3b = new java.util.Vector();
                    vect3.add("Most");
                    vect3a.add("Represented");
                    vect3a.add(MostClubMembers.getText());
                    vect3b.add("Club");
                    dm.addRow(vect3);
                    dm.addRow(vect3a);
                    dm.addRow(vect3b);
                }
                if(!SecondMostClub.getText().equals("")) {
                    java.util.Vector<String> vect4 = new java.util.Vector();
                    java.util.Vector<String> vect4a = new java.util.Vector();
                    vect4.add("2nd Most");
                    vect4a.add("Represented");
                    vect4a.add(SecondMostClub.getText());
                    dm.addRow(vect4);
                    dm.addRow(vect4a);
                }
            }
        }
        else {
            // null reply for report, nothing we can display, or a future error condition?
            //if(debug) {
                logger.log(Level.INFO,
                    "setAwardPanel: empty/null report data set");
            //}
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(AwardsPanel);
        AwardsWait.setVisible(false);
    }
    
    /**
     * break ties between contestant rows in the array of entrant data
     * records passed.  Ties within each class need to be broken so this
     * method needs to track which class it is working on and examine the
     * top N places, depending upon how many have tied for the first 3
     * slots.  The list is already ordered by score, so only tie scores
     * matter, and of course how many are tied which need a tie breaker.
     * @param vals
     * @return input array of strings sorted by scores and tie-breakers
     */
    String[] breakTies(String[] vals) {
        String[] ret = null;
        java.util.ArrayList<String> currGroup = new java.util.ArrayList();
        //String[] currGroup = null;
        String curClass = null;
        String lastClass = null;
        for(int i = 0; i < vals.length; i++) {
            String entry = vals[i];
            String[] v = entry.split(",");
            if(v.length < 13) { // pad short SQL entries, not needed with a good SQL server
                String[] nvals = new String[13];
                System.arraycopy(v, 0, nvals, 0, vals.length);
                for(int a = vals.length; a < nvals.length; a++)
                    nvals[a] = "";
                v = nvals;
            }
            if(curClass == null) curClass = v[1];
            else {
                if(!curClass.equals(v[1])) { // handle class transition in rpt data
                    lastClass = curClass;
                    curClass = v[1];
                    // DO TIE BREAK OF MEMBERS IN THE currGroup array HERE
                    // put them in order into the ret array for passing
                    // back to the caller.
                    int curBest = -1;
                    int bestIdx = -1;
                    java.util.ArrayList<String> outList = new java.util.ArrayList();
                    // The values passed in are already sorted, we just need
                    // to examine each row against the subsequent row and
                    // look for equal scores across them.  Finally, make a
                    // container of only the tied scores that we can tie break
                    // among the peers.
                    java.util.ArrayList<String> peerList = new java.util.ArrayList();
                    for(int j = 0; j < currGroup.size(); j++) {
                        String line = currGroup.get(j);
                        String[] exline = line.split(",");
                        int score = (Integer.parseInt(exline[9]) + Integer.parseInt(exline[10]));
                        String lineNext = currGroup.get(j+1);
                        String[] exlineNext = lineNext.split(",");
                        int scoreNext = (Integer.parseInt(exlineNext[9]) + Integer.parseInt(exlineNext[10]));
                        if(score == scoreNext) { // TIE
                            if(peerList.isEmpty()) {
                                peerList.add(lineNext);
                                peerList.add(line);
                            }
                            else {
                                if(!peerList.contains(line))
                                   peerList.add(line);
                                peerList.add(lineNext);
                            }
                            j++;
                        }
                        else { // not score peers
                            outList.add(line);
                        }
                    }
                    currGroup.clear();
                }
            }
            currGroup.add(entry);
        }
        return ret;
    }
    
    
    /**
     * Reply path for the SQL query requesting club representation counts for
     * determining most represented club at the show.
     * @param args 
     */
    void setClubAward(HashMap[] args) {
        if(args != null && args.length > 0) {
            String Most = null;
            String Second = null;
            int mostSeen = 0;
            int secondSeen = 0;
            for(int i = 0; i < args.length; i++) {
                //String[] vals = args[i].split(",");
                HashMap vals = args[i];
                if(mostSeen == 0 ) {
                    mostSeen = Integer.parseInt((String)vals.get("cnt"));
                    Most = (String)vals.get("club");
                    continue;
                }
                else if (Integer.parseInt((String)vals.get("cnt")) >= mostSeen) {
                    secondSeen = mostSeen;
                    Second = Most;
                    mostSeen = Integer.parseInt((String)vals.get("cnt"));
                    Most = (String)vals.get("club");
                    continue;
                }
                if(secondSeen == 0 & mostSeen > 0) {
                    secondSeen = Integer.parseInt((String)vals.get("cnt"));
                    Second = (String)vals.get("cnt");
                }
                else if(Integer.parseInt((String)vals.get("cnt")) > secondSeen) {
                    secondSeen = Integer.parseInt((String)vals.get("cnt"));
                    Second = (String)vals.get("cnt");
                }
            }
            if(mostSeen > 0 && Most != null)
                MostClubMembers.setText(Most+" ("+mostSeen+")");
            if(secondSeen > 0 && Second != null)
                SecondMostClub.setText(Second+" ("+secondSeen+")");
        }
    }
    /**
     * set the Most Clubs represented and second Most Clubs award fields.
     * @param args 
     */
    @Deprecated
    private void setClubAward(String[] args) {
        if(args != null ) {
            if(args.length == 1) {
                if(args[0].contains(",")) {
                    String[] vals = args[0].split(",");
                    MostClubMembers.setText(vals[0]);
                }
                else {
                    if(debug) logger.log(Level.INFO, "setClubAward: update/insert ret: {0}", args[0]);
                }
            }
            else { // multiple clubs returned, find the highest 2 counters
                // This may be all superflourous because I'm asking for the
                // order to be by the count(*) on the club so it should give
                // the first 2 
                String Most = null;
                String Second = null;
                int mostSeen = 0;
                int secondSeen = 0;
                for(int i = 0; i < args.length; i++) {
                    String[] vals = args[i].split(",");
                    if(mostSeen == 0 ) {
                        mostSeen = Integer.parseInt(vals[1]);
                        Most = vals[0];
                        continue;
                    }
                    else if (Integer.parseInt(vals[1]) >= mostSeen) {
                        secondSeen = mostSeen;
                        Second = Most;
                        mostSeen = Integer.parseInt(vals[1]);
                        Most = vals[0];
                        continue;
                    }
                    if(secondSeen == 0 & mostSeen > 0) {
                        secondSeen = Integer.parseInt(vals[1]);
                        Second = vals[0];
                    }
                    else if(Integer.parseInt(vals[1]) > secondSeen) {
                        secondSeen = Integer.parseInt(vals[1]);
                        Second = vals[0];
                    }
                }
                if(mostSeen > 0 && Most != null)
                    MostClubMembers.setText(Most+" ("+mostSeen+")");
                if(secondSeen > 0 && Second != null)
                    SecondMostClub.setText(Second+" ("+secondSeen+")");
            }
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(MostClubMembers);
        AwardsWait.setVisible(false);
    }
    
    /**
     * initialize the list of car classes on the Registration jPanel.  Called
     * each time we enter the Registration panel as well as during init when
     * we add the class list drop-down to the Registration panel.
     */
    private void initClassList() {
        // Do a sqlGet() spec'ing the EntrantClass as the destination
        // This script removes the existing class list, SqlClientReader() will
        // populate it with DB data using popRegClasses() method.
        //((myJTabbedPane)tabbedPane).setActiveComponent(EntrantClass);
        regWait.setEnabled(true);
        regWait.setVisible(true);
        EntrantClass.removeAllItems();  // clear the list to repopulate
        if(debug) logger.log(Level.INFO,"initClassList: get JudgeClasses list from DB");
        String request = "select * from "
        //String request = "select mnemonic, classname, StartYear, EndYear from "
            +CarShowConstants.JudgeClasses+" order by mnemonic asc;";
        if(debug) logger.log(Level.INFO, "initClassList: request: {0}", request);
        //sqlGet(EntrantClass, request);
        //waitForIt(regWait);
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) setRegClasses(rs);
        regWait.setEnabled(false);
        regWait.setVisible(false);
    }

/**
 * initialize the EntrantClub jComboBox on the Registration panel.
 * This gets called whenever the Entrant Admin jPanel is displayed.
 * This also gets called after we add this combobox to the panel during init.
 */
    private void initClubsList() {
        regWait.setEnabled(true);
        regWait.setVisible(true);
        if(debug) logger.log(Level.INFO,"initClubList: request clubs from DB");
        String request = "select * from Clubs order by club desc;";
        //sqlGet(EntrantClub, request);
        //waitForIt(regWait);
        //if (regWait.isVisible()) logger.log(Level.INFO,"initClubList: wait never ended");
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) setRegClubs(rs);
        regWait.setEnabled(false);
        regWait.setVisible(false);
    }

    /**
     * Initialize the car classes jPanel (Class Administration Setup).
     */
    private void initClassTable() {
        String request = "select * from JudgeClasses order by mnemonic desc;";
        ClassWait.setEnabled(true);
        ClassWait.setVisible(true);
        //sqlGet(ClassListTable, request);
        //waitForIt(ClassWait);
        //if(ClassWait.isVisible()) {
         //   logger.log(Level.INFO,"initClassTable: wait never ended");
         //   ClassWait.setVisible(false);
        //}
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) setClassList(rs);
        regWait.setEnabled(false);
        regWait.setVisible(false);
    }

    /**
     * Print the paper for the show.  This includes 2 copies of the
     * judging sheets and 1 copy of the entrant display sheet that has
     * their entrant number printed on it.  The values used come from
     * the Registration panel and the Administration panel (for the date
     * string printed at the top.)
     */
    private void printScoringSheets(int type) {
        regWait.setVisible(true);
        regWait.setEnabled(true);
        // this next will get you current date, we are using the form
        // date data (Administration panel) So, make sure the client knows
        // that is the master value for printing dates on forms.
        Calendar cal = GregorianCalendar.getInstance();
        String calFormat = "MMM d, yyyy";
        SimpleDateFormat sdf = new SimpleDateFormat(calFormat);
        
        // the commented line in this constructor call would use the
        // current date instead of the date entered on the registration
        // panel, which is a user controllable value.  It is believed
        // by the the author (wdm) that this is the desired operation
        // because then sheets printed will reflect the date that the
        // conducting club wants displayed on the form, in their specific
        // format.
        // 4/29/12 format change to class display field, now with form
        // displaying a longer string we need to substring out the class
        // mnemonic from the front of that string
        // 6/11/12 add call to getAdminData() so the info on ShowName
        // and ShowDate are accurate (as set on server) for print job
        getAdminData();
        JudgingSheet js; 
        if(type == 0) {
            js = new JudgingSheet(ContestName.getText(), 
            //sdf.format(cal.getTime()), EntrantNumber.getText().trim(),
            ShowDate.getText(), EntrantNumber.getText().trim(),
            EntrantParking.getText().trim(), EntrantMake.getText().trim(),
            EntrantModel.getText().trim(), EntrantColor.getText().trim(),
            EntrantYear.getText().trim(),((String)EntrantClass.getSelectedItem()));
        } else {
            js = new judgingmcsheet(ContestName.getText(), 
            //sdf.format(cal.getTime()), EntrantNumber.getText().trim(),
            ShowDate.getText(), EntrantNumber.getText().trim(),
            EntrantParking.getText().trim(), EntrantMake.getText().trim(),
            EntrantModel.getText().trim(), EntrantColor.getText().trim(),
            EntrantYear.getText().trim(),((String)EntrantClass.getSelectedItem()));
        }
            // this would strip the text from the class, but we want it printed
            //.substring(0,((String)EntrantClass.getSelectedItem()).indexOf(" ")));
        js.initPrint();
        js.setSize(840,580); // SETS SIZE OF PRINTED OBJECT IN SCORING SHEET
        //java.awt.print.PageFormat pf = new java.awt.print.PageFormat();
        //pf.setOrientation(java.awt.print.PageFormat.LANDSCAPE);
        PrinterJob printJob = PrinterJob.getPrinterJob();
        printJob.setCopies(2);
        printJob.setPrintable(js);
        if(printJob.printDialog()) {
            try {
                printJob.print();
            }
            catch(PrinterException pe) {
                logger.log(Level.INFO, "Exception Error printing: {0}", pe);
            }
        }
        if(!printJob.isCancelled() && js.getPrinted()) {
            setEntrantPrinted(EntrantNumber.getText());
        }
        regWait.setVisible(false);
        regWait.setEnabled(false);
    }
    /**
     * sets the printed value in the Entrants table of the CarShow database to
     * indicate an entrant has been printed at least once.
     * @param ent the registration number that was printed
     */
    
    private void setEntrantPrinted(String ent) {
        String tbl;
        if(winHost) tbl = CarShowConstants.winEntrants;
        else tbl = CarShowConstants.Entrants;
        if(ent != null && !ent.equals("")) {
            String request = "update "+this.DBname+"."+tbl+" set "+
                " printed = \"*\" where entrant_num = "+ent;
            regWait.setEnabled(true);
            regWait.setVisible(true);
            if(debug) logger.log(Level.INFO, "setEntPrinted: request: {0}", request);
            int ret = execDBUpdate(request);
            if(ret > 0) {
                this.ThisEntrantPrinted = true;
                RegPrint.setForeground(Color.MAGENTA);
            }
            regWait.setEnabled(false);
            regWait.setVisible(false);
            //sqlPut(RegPrint, request);
            //waitForIt(regWait);
            //if (regWait.isVisible()) { 
            //    logger.log(Level.INFO,"setEntPrinted: wait never ended");
            //    regWait.setVisible(false);
            //}
            //else ThisEntrantPrinted = true; // this may be needed or desirable
        }
    }
    
    /**
     * Reply path from SqlClientReader on setEntrantPrint() request.  Used to
     * inform the UI if the print job actually was printed by the print
     * subsystem.  The return code from the SQL request is passed to this
     * method to decide if the print status should be updated.  Since we cannot
     * know if the print job actually finished/printed, we assume that setting
     * the DB Entrants table value is sufficient to mark this as completed.
     * @param ret string assumed to contain a single integer character of the return code
     */
    void updatePrintStatus(String ret) {
        if(ret == null) 
            if(debug) logger.log(Level.INFO,
                "updPrintStat: null ret - may indicate update failure");
        else {
            if (Integer.parseInt(ret) < 0) 
                if(debug) logger.log(Level.INFO,
                    "updPrintStat: neg ret - probably update failed");
            RegPrint.setForeground(oldPrintColor);
        }
        // if non-negative, DB success, should always be 1 returned
        if(ret.equals("1")) {
            RegPrint.setForeground(java.awt.Color.magenta);
            ThisEntrantPrinted=true;
            this.repaint();
        }
        else {
            RegPrint.setForeground(oldPrintColor);
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(RegPrint);
        regWait.setVisible(false);
        ThisEntrantPrinted=true;
    }
    
    /**
     * set the entrant registration form data to the Archive table values passed
     * in the comma separated values (CSV) string supplied.
     * @param retEnt CSV string with values to populate the registration panel
     */
    void setArchiveEntrant(String retEnt) {
        ThisEntrantPrinted = false;
        if(retEnt != null) {
            if(retEnt.length() > 0) {
                clearEntrant();
                String[] flds = retEnt.split(",");
                int totflds = flds.length;
                if(totflds > 0 && flds[0].length() > 0) FirstName.setText(flds[0]);
                if(totflds > 1 && flds[1].length() > 0) LastName.setText(flds[1]);
                if(totflds > 2 && flds[2].length() > 0) EntrantAddress.setText(flds[2]);
                if(totflds > 3 && flds[3].length() > 0) EntrantCity.setText(flds[3]);
                if(totflds > 4 && flds[4].length() > 0) EntrantState.setText(flds[4]);
                if(totflds > 5 && flds[5].length() > 0) EntrantZipCode.setText(flds[5]);
                if(totflds > 6 && flds[6].length() > 0) EntrantPhone.setText(flds[6]);
                if(totflds > 7) {
                    if((flds[7].length() > 0) & !(flds[7].trim().equals("null")))
                        EntrantClub.setSelectedItem(flds[7]);
                    else
                        EntrantClub.setSelectedItem("");
                    EntrantClub.setEditable(true);
                }
                EntrantYear.requestFocus();
                AddEntrant.setText("Add Entrant");
                RegPrint.setVisible(false);
                EntrantDeleteButton.setEnabled(false);
            }
            else {
                clearEntrant();
            }
        }
    }
    
    /**
     * set the registration form to the values returned by an entrant archive
     * search result.
     * @param retEnt hashmap of archive data values found in search
     */
    void setArchiveEntrant(HashMap retEnt) {
        // Although this can handle an array of hashmaps, there should only
        // be a single hashmap object returned/passed so this API contract
        // may change to only a single hashmap.
        ThisEntrantPrinted = false;
        if(retEnt != null) {
            if(!retEnt.isEmpty()) {
                clearEntrant();
                EntrantNumber.setText((String)retEnt.get("entrant_num"));
                FirstName.setText((String)retEnt.get("fname"));
                LastName.setText((String)retEnt.get("lname"));
                EntrantAddress.setText((String)retEnt.get("address"));
                EntrantCity.setText((String)retEnt.get("city"));
                EntrantState.setText((String)retEnt.get("state"));
                EntrantZipCode.setText((String)retEnt.get("zip"));
                EntrantPhone.setText((String)retEnt.get("phone"));
            }
        }
    }
    
    /**
     * reply path for entrant search operations. Search data in the form of
     * an array of HashMap objects us used to populate either a search
     * results table from which to choose the desired search result, or if
     * only one hashmap has been returned, it is used to populate the
     * registration panel.
     * @param data hashmap array of entrant search results
     */
    void setEntrant(HashMap[] data) {
        if(data == null || data.length == 0) {
            setEntrant(new HashMap());
        }
        else if(data.length > 1) {
                setMultiEntrant(data);
        }
        else {
            setEntrant(data[0]);
        }
    }
    
    /**
     * Sets the entrant registration panel to the values in the HashMap provided.
     * @param data entrant registration data
     */
    void setEntrant(HashMap data) {
        this.ThisEntrantPrinted = false;
        if(data != null && !data.isEmpty()) {
            if(data.containsKey("entrant_num"))
                EntrantNumber.setText((String)data.get("entrant_num"));
            if(data.containsKey("parking_loc")) {
                String val = (String)data.get("parking_loc");
                if(!val.equals("null") && !val.isEmpty())
                    EntrantParking.setText((String)data.get("parking_loc"));
                else EntrantParking.setText("");
            }
            if(data.containsKey("fname"))
                FirstName.setText((String)data.get("fname"));
            if(data.containsKey("lname"))
                LastName.setText((String)data.get("lname"));
            if(data.containsKey("address"))
                EntrantAddress.setText((String)data.get("address"));
            if(data.containsKey("city"))
                EntrantCity.setText((String)data.get("city"));
            if(data.containsKey("state"))
                EntrantState.setText((String)data.get("state"));
            if(data.containsKey("zip"))
                EntrantZipCode.setText((String)data.get("zip"));
            if(data.containsKey("phone"))
                EntrantPhone.setText((String)data.get("phone"));
            if(data.containsKey("year"))
                EntrantYear.setText((String)data.get("year"));
            if(data.containsKey("make"))
                EntrantMake.setText((String)data.get("make"));
            if(data.containsKey("model"))
                EntrantModel.setText((String)data.get("model"));
            if(data.containsKey("color"))
                EntrantColor.setText((String)data.get("color"));
            if(data.containsKey("mnemonic")) {
                for(int i = 0; i < EntrantClass.getItemCount(); i++) {
                    String c = (String)EntrantClass.getItemAt(i);
                    if(c.equals("")) continue;
                    c = c.substring(0,c.indexOf(" "));
                    if(c.equals(data.get("mnemonic"))) {
                        EntrantClass.setSelectedIndex(i);
                        break;
                    }
                }
            }
            if(data.containsKey("club"))
                EntrantClub.setSelectedItem((String)data.get("club"));
            oldPrintColor = RegPrint.getForeground();
            if(data.containsKey("printed") && 
                    data.get("printed") != null && 
                    ((String)data.get("printed")).equals("*")) {
                RegPrint.setForeground(java.awt.Color.magenta);
                ThisEntrantPrinted=true;
            }
            else {
                RegPrint.setForeground(oldPrintColor);
            }
            if(!RegPrint.isVisible()) RegPrint.setVisible(true);
            AddEntrant.setText("Change");
            EntrantDeleteButton.setEnabled(true);
            EntrantDeleteButton.setForeground(java.awt.Color.BLACK);
            String epText = EntrantParking.getText();
            if(epText.equals("")) //EntrantParking.requestFocus();
                EntrantParking.requestFocus();
            else FirstName.requestFocus();
        }
        else {
            logger.log(Level.INFO, "setEntrant recvd "+
                "empty hashmap delete/non-exist entrant case");
            clearEntrant();
            //EntrantParking.requestFocus();
            FirstName.requestFocus();
            if(!in_init) {
                AddEntrant.setText("Add Entrant");
                RegPrint.setVisible(false);
            }
            EntrantDeleteButton.setEnabled(false);
        }
        repaint();
    }
    /**
     * return path when an entrant is selected from either the entrant search
     * or archive search operations.  This uses a comma separated values format
     * to pass the DB data back to the the form.  This is less robust than the
     * HashMap method of key-> value due to the legacy of this functionality.
     * A strong contract of what fields are in what CSV column is required so
     * the way the values are stored/saved in the carshow.ArchiveSearchResults or
     * carshow.EntrantSearchResults classes rawdata.
     * 
     * @param retEnts comma separated SQL result set
     */
    void setEntrant(String retEnts) {
        ThisEntrantPrinted=false; // set below set it true if it is so...
        if(retEnts != null) {
            // populate the form with the values in the EntrantData[] array
            // first check if > 1 returned, which is invalid...
            if(retEnts.length() > 0) {
                clearEntrant();
                String[] flds = retEnts.split(",");
                int totflds = flds.length;
                if(totflds > 0 && flds[0].length() > 0 ) EntrantNumber.setText(flds[0]);
                if(totflds > 1 && flds[1].length() > 0 ) FirstName.setText(flds[1]);
                if(totflds > 2 && flds[2].length() > 0 ) LastName.setText(flds[2]);
                if(totflds > 3 && flds[3].length() > 0 ) {
                    for(int i = 0; i < EntrantClass.getItemCount(); i++) {
                        String c = (String)EntrantClass.getItemAt(i);
                        if(c.equals("")) continue;
                        c = c.substring(0,c.indexOf(" "));
                        if(c.equals(flds[3])) {
                            EntrantClass.setSelectedIndex(i);
                            break;
                        }
                    }
                }
                if(totflds > 4 && flds[4].length() > 0 ) EntrantAddress.setText(flds[4]);
                if(totflds > 5 && flds[5].length() > 0 ) EntrantCity.setText(flds[5]);
                if(totflds > 6 && flds[6].length() > 0 ) EntrantState.setText(flds[6]);
                if(totflds > 7 && flds[7].length() > 0 ) EntrantZipCode.setText(flds[7]);
                if(totflds > 8 && flds[8].length() > 0 ) EntrantPhone.setText(flds[8]);
                if(totflds > 9 && flds[9].length() > 0 ) EntrantMake.setText(flds[9]);
                if(totflds > 10 && flds[10].length() > 0 ) EntrantModel.setText(flds[10]);
                if(totflds > 11 && flds[11].length() > 0 ) EntrantColor.setText(flds[11]);
                if(totflds > 12 && flds[12].length() > 0 ) EntrantYear.setText(flds[12]);
                if(totflds > 13 && flds[13].length() > 0 ) EntrantParking.setText(flds[13]);
                if(totflds > 14 && flds[14].length() > 0 ) EntrantClub.setSelectedItem(flds[14]);
                //if(totflds > 15 && flds[15].equals("1"))
                //    RegStatusButtonGroup.setSelected(PreRegButton.getModel(), true);
                //else RegStatusButtonGroup.setSelected(CheckInButton.getModel(), true);
                AddEntrant.setText("Change");
                if(!RegPrint.isVisible()) RegPrint.setVisible(true);
                oldPrintColor = RegPrint.getForeground();
                
                // change the RegPrint btn color if it has been printed
                // db flds[16] is either "*" or empty/null
                if(flds.length > 16 && flds[16] != null && 
                        !flds[16].equals("") && !flds[16].equals("null")) {
                    RegPrint.setForeground(java.awt.Color.magenta);
                    ThisEntrantPrinted=true;
                }
                else {
                    RegPrint.setForeground(oldPrintColor);
                }
                EntrantDeleteButton.setEnabled(true);
                EntrantDeleteButton.setForeground(java.awt.Color.BLACK);
            }
        }
        else { // Deleted/non-existent Entrant case lands here
            if(debug) logger.log(Level.INFO, "setEnt recvd a null - delete/non-exist entrant case");
            clearEntrant();
            //EntrantParking.requestFocus();
            FirstName.requestFocus();
            if(!in_init) {
                AddEntrant.setText("Add Entrant");
                RegPrint.setVisible(false);
            }
            EntrantDeleteButton.setEnabled(false);
            RegPrint.setEnabled(false);
            /*regWait.setVisible(false);
            if(((myJTabbedPane)tabbedPane).getActiveComponent().getName().
                    equals(EntrantDeleteButton.getName())) {
                ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantDeleteButton);
            }
            else {
                ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
            }*/
        }
        if (!in_init) {
            //  normally this is a problem, but with the design chgs this
            // is not necessary because we now absorb the call on multiEntrant
            // return cases so this will fire implying an error although this
            // is expected.  We should just clear an active component if set
            // and maybe complain if the active component isnt RegPanel...
            Component c = ((myJTabbedPane)tabbedPane).getActiveComponent();
            if ( c != null && c.getName().equals(RegistrationPanel.getName())) {
                if(debug) logger.log(Level.INFO,
                    "setEntrant: clear RegPanel ActiveComponent");
                ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
            }
            else if (c != null && c.getName().equals(EntrantDeleteButton.getName())) {
                if(debug) logger.log(Level.INFO,
                    "setEntrant: clear EntDeleteBtn ActiveComponent");
                ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantDeleteButton);
            }
            else if (c != null && c.getName().equals(EntrantClear.getName())) {
                if(debug) logger.log(Level.INFO,
                    "setEntrant: clear EntrantClear ActiveComponent");
                ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClear);
            }
            else {
                if(debug) logger.log(Level.INFO,
                    "setEntrant: active component is null or unexpected");
                if(c == null & debug) logger.log(Level.INFO,"act component is null");
                else {
                    if(debug) logger.log(Level.INFO, "act component: {0}", c.getName());
                    ((myJTabbedPane)tabbedPane).clearActiveComponent(c);
                }
            }
            regWait.setVisible(false);
        }
    }
    /**
     * Populate the entrant registration panel using the supplied values
     * in the HashMap.  This is the return path on an entrant Add operation
     * so the only expected value in the HashMap be the new entrant number.
     * @param retEnts HashMap of SQL data for the new entrant (entrant #)
     */
    void updEntrant(HashMap retEnts) {
        if(retEnts == null || retEnts.isEmpty()) return;
        if(retEnts.containsKey("entrant_num")) {
            if(!in_update)
                EntrantNumber.setText((String)retEnts.get("entrant_num"));
            String s = (String)EntrantClass.getSelectedItem();
            if(s.equals("")) { // correct for add w/o class specified, select the default
                for(int i = 0; i < EntrantClass.getItemCount(); i++) {
                    String ss = (String)EntrantClass.getItemAt(i);
                    if (!ss.equals("") && ss.substring(0,ss.indexOf(" ")).equals("PRE")) {
                        EntrantClass.setSelectedItem(i);
                    }
                }
            }
            if(!AddEntrant.getText().equals("Change")) AddEntrant.setText("Change");
            FirstName.requestFocus();
            if(((myJTabbedPane)tabbedPane).getActiveComponent() != null) {
                if(debug) logger.log(Level.INFO,
                    "updEntrant2: disable ActiveComponent");
                ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
            }
        }
        in_update = false; // update done
        regWait.setVisible(false);
        EntrantDeleteButton.setEnabled(true);
    }
    /**
     * Reply path for SqlClientReader to update the entrant data on the
     * registration panel when an New Entrant is Added.  Modifications are
     * returned through setEntrant()
     */
    @Deprecated
    void updEntrant(String retEnts) {
        if(debug) logger.log(Level.INFO, "updEntrant: rcvd string: {0}", retEnts);
        if(retEnts.matches("[1-9]+")) {
            // Check if this is a new entrant's number
            //if(AddEntrant.getText().equals("Add Entrant") && EntrantNumber.getText().equals(""))
            if(!in_update)
                EntrantNumber.setText(retEnts.trim());
            String s = (String)EntrantClass.getSelectedItem();
            if(s.equals("")) { // correct for add w/o class specified, select the default
                for(int i = 0; i < EntrantClass.getItemCount(); i++) {
                    String ss = (String)EntrantClass.getItemAt(i);
                    if (!ss.equals("") && ss.substring(0,ss.indexOf(" ")).equals("PRE")) {
                        EntrantClass.setSelectedItem(i);
                    }
                }
            }
            // if not in Change mode on the form, make it change mode now
            if(!AddEntrant.getText().equals("Change")) AddEntrant.setText("Change");
            FirstName.requestFocus();
            if(((myJTabbedPane)tabbedPane).getActiveComponent() != null) {
                if(debug) logger.log(Level.INFO,
                    "updEntrant2: disable ActiveComponent");
                ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
            }
        }
        in_update = false; // update done
        regWait.setVisible(false);
        EntrantDeleteButton.setEnabled(true);
    }
    /**
     * formats the return data from an archive search into a scroll-able
     * table allowing selection from the list provided to populate the
     * entrant fields in preparation for adding an archived entrant into the
     * current car show.  The frame containing the selection table results
     * is displayed when this method is finished.
     * @param sqlData HashMap array containing entrant data from the archive table.
     */
    void setMultiArchiveEntrant(HashMap[] sqlData) {
        if(sqlData == null || sqlData.length == 0) return;
                ArchiveSearchResults asr = new ArchiveSearchResults();
        for(int i = 0; i < sqlData.length; i++) {
//Sample entry: Fred, Flint, 12345 Elton, Hoboken, JA, 55555, 2134556677, null
            HashMap entry = sqlData[i];
            
            String[] sb = new String[entry.size()];
            for(int j = 0; j < entry.size(); j++) {
                if(entry.containsKey(CarShowConstants.archiveOrder[j])) {
                    sb[j]=(String)entry.get(CarShowConstants.archiveOrder[j]);
                }
            }
            if(i < asr.resultTable.getRowCount()) {
                ((ArchiveSelectTableModel)asr.resultTable.getModel()).removeRow(i);
                ((ArchiveSelectTableModel)asr.resultTable.getModel()).insertRow(i, sb);
            }
            else
                ((ArchiveSelectTableModel)asr.resultTable.getModel()).addRow(sb);
        }
        // put the popup in the middle of the screen
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

        int w = asr.getSize().width;
        int h = asr.getSize().height;
        int x = (dim.width-w)/2;
        int y = (dim.height-h)/2;
        asr.setLocation(x, y);
        asr.scaleTable();
        asr.setEnabled(true);

        ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
        regWait.setVisible(false);
        asr.setVisible(true);
        asr.requestFocus();
        asr.setAlwaysOnTop(true);
    }
    /**
     * formats the return data from an archive search into a scroll-able
     * table allowing selection from the list provided to populate the
     * entrant fields in preparation for adding an archived entrant into the
     * current car show.  The frame containing the selection table results
     * is displayed when this method is finished.
     * @param sqlData comma separated values strings containing entrant data
     * from the archive table.
     * 
     * Sample string in sqlData[]: 
     * entry = "Fred, Flint, 12345 Elton, Hoboken, JA, 55555, 2134556677, null"
     */

    public void setMultiArchiveEntrant(String[] sqlData) {
        if(sqlData.length <= 0) return;
        ArchiveSearchResults asr = new ArchiveSearchResults();
        for(int i = 0; i < sqlData.length; i++) {
            String entry = sqlData[i];
            String[] vals = entry.split(",");
            if(vals.length < 8) {
                String[] nvals = new String[8];
                System.arraycopy(vals, 0, nvals, 0, vals.length);
                if(vals.length == 6) nvals[6] = "";
                nvals[7] = "";
                vals = nvals;
            }
            if(i < asr.resultTable.getRowCount()) {
                ((ArchiveSelectTableModel)asr.resultTable.getModel()).removeRow(i);
                ((ArchiveSelectTableModel)asr.resultTable.getModel()).insertRow(i, vals);
            }
            else
                ((ArchiveSelectTableModel)asr.resultTable.getModel()).addRow(vals);
        }
        // put the popup in the middle of the screen
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

        int w = asr.getSize().width;
        int h = asr.getSize().height;
        int x = (dim.width-w)/2;
        int y = (dim.height-h)/2;
        asr.setLocation(x, y);
        asr.scaleTable();
        asr.setEnabled(true);

        ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
        regWait.setVisible(false);
        asr.setVisible(true);
        asr.requestFocus();
        asr.setAlwaysOnTop(true);
    }
    /**
     * Handle setting the multiple replies from an entrant search into the
     * selector screen by populating the table data from the supplied hashmap
     * values.  This is a search entrant path handler. 
     * @param sqlData Array of hashmaps containing entrants table report data
     * 
     */
    void setMultiEntrant(HashMap[] sqlData) {
        EntrantSearchResults esr = null;
        if(sqlData.length == 0) return;
        if(sqlData.length > 0) {
            esr = new EntrantSearchResults();
            for(int i = 0; i < sqlData.length; i++) {
                String[] vals = new String[19];
                HashMap nxt = sqlData[i];
                //String[] displayOrder = {"entrant_num","mnemonic","fname",
                //    "lname","address","city","state","make","model"};
                for(int k = 0; k < vals.length; k++) {
                    vals[k] = (String)nxt.get(CarShowConstants.entrantOrder[k]);
                }
                if(i < esr.resultTable.getRowCount()) {
                    ((EntrantSelectTableModel)esr.resultTable.getModel()).removeRow(i);
                    ((EntrantSelectTableModel)esr.resultTable.getModel()).insertRow(i, vals);
                }
                else
                    ((EntrantSelectTableModel)esr.resultTable.getModel()).addRow(vals);
            }
            Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
            
            int w = esr.getSize().width;
            int h = esr.getSize().height;
            int x = (dim.width-w)/2;
            int y = (dim.height-h)/2;
            esr.setLocation(x, y);
            esr.scaleTable();
            esr.setEnabled(true);
        }
        regWait.setVisible(false);
        if(esr != null) {
            esr.setVisible(true);
            esr.requestFocus();
            esr.setAlwaysOnTop(true);
        }
    }
    /**
     * return path for multiple entrant return data from a entrant search
     * on the registration panel.  To fully appreciate the difference between
     * the setEntrant() and setMultiEntrant() methods, setMultiEntrant must
     * launch a selector pane that the user can select the desired entrant
     * from, which then must populate the main Registration panel with the
     * chosen entrant.  This is deprecated in the MySQL release and was only
     * applicable to earlier renditions.
     * @param sqlData 
     */
    @Deprecated
    public void setMultiEntrant(String[] sqlData) {
        EntrantSearchResults esr = null;
        if(sqlData.length > 0) {
            esr = new EntrantSearchResults();

            // a typical search results set line that would come in sqlData
            // 5,Tom,Tate,PRE,3409 Holland Dr,Yalte,WI,23232,111-222-3333,Ford,Truck,Black,1937,,,1
            for(int i = 0; i < sqlData.length; i++) {

                String entry = sqlData[i];
                String[] vals = entry.split(",");
                if(vals.length < 19) {
                    String[] nvals = new String[19];
                    System.arraycopy(vals, 0, nvals, 0, vals.length);
                    if(vals.length == 17) nvals[17] = "";
                    nvals[18] = "";
                    vals = nvals;
                }
                if(i < esr.resultTable.getRowCount()) {
                    ((EntrantSelectTableModel)esr.resultTable.getModel()).removeRow(i);
                    ((EntrantSelectTableModel)esr.resultTable.getModel()).insertRow(i, vals);
                }
                else
                    ((EntrantSelectTableModel)esr.resultTable.getModel()).addRow(vals);
            }
            // put the popup in the middle of the screen, or middle of this app itself
            //Dimension uidim = ((CarShowUI)this).getSize();
            Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
            
            int w = esr.getSize().width;
            int h = esr.getSize().height;
            int x = (dim.width-w)/2;
            int y = (dim.height-h)/2;
            esr.setLocation(x, y);
            //int rowcnt = esr.resultTable.getRowCount();
            //int tblsize = esr.resultTable.getHeight();
            //int btnsize = esr.selButton.getHeight();
            //int newheight = tblsize + btnsize + 5;
            //esr.setSize(700,300);
            esr.scaleTable();
            esr.setEnabled(true);
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(RegistrationPanel);
        regWait.setVisible(false);
        if(esr != null) {
            esr.setVisible(true);
            esr.requestFocus();
            esr.setAlwaysOnTop(true);
        }
    }
    /**
     * Clears the contents of the registration panel
     */
    void clearEntrant() {
        if(debug) logger.log(Level.INFO,"clearEntrant: ***DELETING REGISTRATION FORM DATA***");
        if(!this.isVisible())
            return;
        EntrantNumber.setText("");
        FirstName.setText("");
        LastName.setText("");
        EntrantClass.setSelectedItem("");
        EntrantAddress.setText("");
        EntrantCity.setText("");
        EntrantState.setText("");
        EntrantZipCode.setText("");
        EntrantPhone.setText("");
        EntrantMake.setText("");
        EntrantModel.setText("");
        EntrantColor.setText("");
        EntrantYear.setText("");
        EntrantParking.setText("");
        boolean skip = false;
        if(EntrantClub.getItemCount() > 0 && !EntrantClub.getSelectedItem().equals("")) {
            if(activeClubs.length > 0) {
                for(int i = 0; i < activeClubs.length; i++) {
                    if (activeClubs[i].equals(EntrantClub.getSelectedItem()))
                        skip = true;
                }
                if(!skip) {
                    String[] nactive = new String[activeClubs.length+1];
                    System.arraycopy(activeClubs, 0, nactive, 0, activeClubs.length);
                    nactive[activeClubs.length] = (String)EntrantClub.getSelectedItem();
                    activeClubs = nactive;
                }
                // add any new clubs in activeClubs to the EntrantClub dropdown
                if(EntrantClub.getItemCount() < activeClubs.length) {
                    for(int k = EntrantClub.getItemCount(); k < activeClubs.length; k++)
                        EntrantClub.addItem(activeClubs[k]);
                }
            }
        }
        EntrantClub.setSelectedItem("");
        // This next block prefers the PRE class as default, if it exists
        // without this, Class dropdown defaults to current display value
/*        if(EntrantClass.getItemCount() > 0)
            for(int k = 0; k < EntrantClass.getItemCount(); k++) {
                if(EntrantClass.getItemAt(k).equals("PRE")) {
                    EntrantClass.setSelectedItem("PRE");
                    break;
                }
            } */
        RegPrint.setForeground(oldPrintColor);
        RegPrint.setVisible(false);
        AddEntrant.setText("Add Entrant");
        EntrantDeleteButton.setText("Delete");
        EntrantDeleteButton.setEnabled(false);
        focusSearch = false;
        in_update = false; // reset update/add state flag to add
        initClubsList();   // update view of known clubs from DB
    }
    /**
     * Set the list of judging classes on the registration panel.  This
     * is the path taken when the registration panel is activated and the
     * classes dropdown needs populating.
     * @param classes array of car class data in HashMap objects
     */
    void setRegClasses(HashMap[] classes) {
        if(classes == null || classes.length == 0) return;
        if(activeClasses == null) {
            activeClasses = new String[classes.length];
        }
        else {
            if (classes.length > activeClasses.length) {
                activeClasses = new String[classes.length];
            }
        }
        boolean[] foundClasses = new boolean[classes.length];
        if(classes.length > 0) {
            int curr_count = EntrantClass.getItemCount();
            for (int i = 0; i < classes.length; i++) {
                //if (classes[i] == null || classes[i].isEmpty())
                //    continue;
                String flds = (String)classes[i].get("mnemonic")+" "+(String)classes[i].get("classname");
                for (int k = 0; k < curr_count; k++) {
                    if (EntrantClass.getComponent(k).toString().equals(flds))
                        foundClasses[i]=true;
                }
            }
            // b/c we return these in reverse order, swap it here
            for(int i = classes.length-1; i >= 0; i--) {
                //if(classes[i] == null || classes[i].isEmpty()) // probably superflourous
                //    continue;                                  // in this design
                activeClasses[i] = (String)classes[i].get("mnemonic");
                if(!foundClasses[i])
                    EntrantClass.addItem((String)classes[i].get("mnemonic")+" "+
                        (String)classes[i].get("classname"));
            }
        }
        // provide a blank element in the list for searching, at the top
        if(EntrantClass.getItemCount() == classes.length)
            EntrantClass.insertItemAt("",0);
        ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClass);
        regWait.setVisible(false);
    }
    /**
     * set the list judging classes on the Registration Panel.  This
     * is the callback from the SqlClientReader() to populate the classes selector.
     * @param classes array of class data objects to display in the field.
     */
    @Deprecated
    void setRegClasses(String[] classes) {
        if(classes ==  null || classes.length == 0) return;
        if(activeClasses == null) {
            activeClasses = new String[classes.length];
        }
        else {
            if (classes.length > activeClasses.length) {
                activeClasses = new String[classes.length];
            }
        }
        boolean[] foundClasses = new boolean[classes.length];
        if(classes.length > 0) {
            int curr_count = EntrantClass.getItemCount();
            for (int i = 0; i < classes.length; i++) {
                if (classes[i] == null || classes[i].equals(""))
                    continue;
                String[] flds = classes[i].split(",");
                for (int k = 0; k < curr_count; k++) {
                    if (EntrantClass.getComponent(k).toString().equals(flds[0]))
                        foundClasses[i]=true;
                }
            }
            for(int i = 0; i < classes.length; i++) {
                if(classes[i] == null || classes[i].equals(""))
                    continue;
                String[] flds = classes[i].split(",");
                activeClasses[i] = flds[0];
                if(!foundClasses[i])
                    EntrantClass.addItem(flds[0]+" "+flds[1]);
            }
        }
        // provide a blank element in the list for searching
        if(EntrantClass.getItemCount() == classes.length)
            //EntrantClass.addItem("");
            EntrantClass.insertItemAt("",0);
        ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClass);
        regWait.setVisible(false); // end RegistrationPanel.EntrantClass field update
    }
    
    /**
     * Set the registration panel Clubs dropdown list/field on init and when
     * a club has been added by a new Entrant add action/event.
     * @param _clubs HashMap array of clubs in the DB
     */
    void setRegClubs(HashMap[] _clubs) {
        if(_clubs == null || _clubs.length == 0) {
            logger.log(Level.WARNING,"setRegClubs: null/0 len clubs hashmap recieved");
            return;
        }
        if(debug) logger.log(Level.INFO, "setRegClubs: num recd: {0}", _clubs.length);
        if (activeClubs == null) {
            activeClubs = new String[_clubs.length];
        }
        else {
            if (_clubs.length > activeClubs.length)
                activeClubs = new String[_clubs.length];
        }
        boolean[] foundClubs = new boolean[_clubs.length];
        if(_clubs.length > 0) {
            int curr_count = EntrantClub.getItemCount();
            for (int i = 0; i < _clubs.length; i++) {
                for (int k = 0; k < curr_count; k++) {
                    if(EntrantClub.getItemAt(k).equals(_clubs[i].get("club")))
                        foundClubs[i] = true;
                }
            }
            for (int i = 0; i < _clubs.length; i++) {
                activeClubs[i] = (String)_clubs[i].get("club");
                if(!foundClubs[i])
                    EntrantClub.addItem(_clubs[i].get("club"));
            }
        }
        EntrantClub.setSelectedItem("");
        if(debug) logger.log(Level.INFO, "setRegClubs: clear ActiveComponent");
        ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClub);
        regWait.setVisible(false);
        repaint();
    }
    /**
     * set the Registration JPanel object's Clubs list dropdown field on
     * Reg panel entry and when a new club has been added by a new Entrant
     * action/event.
     * @param _clubs string array of the clubs found in the DB and returned
     * by CarShow.SqlClientReader class.
     */
    @Deprecated
    void setRegClubs(String[] _clubs) {
        if(_clubs == null || _clubs.length == 0) { // strange condition we dont expect
            logger.log(Level.INFO, "setRegClubs: null or 0 len Clubs operation reply",
                (_clubs == null) ? "Null" : "Zero");
        }
        else if(_clubs.length == 1 && _clubs[0].matches("[-]*[0-9]+")) {
            if(debug) logger.log(Level.INFO, "detected numeric (retcode) in setRegClubs request");
            int ret = Integer.parseInt(_clubs[0]);
            if(ret > 0 & !EntrantClub.getSelectedItem().equals("")) { // successful DB update of a club add it to our internal table
                if(activeClubs == null) {
                    activeClubs = new String[1];
                    activeClubs[0] = (String)EntrantClub.getSelectedItem();
                }
                else {
                    String[] nact = new String[activeClubs.length+1];
                    System.arraycopy(activeClubs, 0, nact, 0, activeClubs.length);
                    nact[activeClubs.length] = (String)EntrantClub.getSelectedItem();
                    activeClubs = nact;
                }
            }
        }
        else { // SQL data response
            if(debug) logger.log(Level.INFO, "setRegClubs: num recd: {0}", _clubs.length);
            if (activeClubs == null) {
                activeClubs = new String[_clubs.length];
            }
            else {
                if (_clubs.length > activeClubs.length)
                    activeClubs = new String[_clubs.length];
            }
            boolean[] foundClubs = new boolean[_clubs.length];
            if(_clubs.length > 0) {
                int curr_count = EntrantClub.getItemCount();
                for (int i = 0; i < _clubs.length; i++) {
                    for (int k = 0; k < curr_count; k++) {
                        if(EntrantClub.getItemAt(k).equals(_clubs[i]))
                            foundClubs[i] = true;
                    }
                }
                for (int i = 0; i < _clubs.length; i++) {
                    activeClubs[i] = _clubs[i];
                    if(!foundClubs[i])
                        EntrantClub.addItem(_clubs[i]);
                }
            }
            EntrantClub.setSelectedItem("");
        }
        if(debug) logger.log(Level.INFO,
            "setRegClubs: clear ActiveComponent");
        ((myJTabbedPane)tabbedPane).clearActiveComponent(EntrantClub);
        regWait.setVisible(false);
        repaint();
    }
    
    /*******************************************************************/
    /** Set the list of classes on the Car Class Administration panel.
     * @param cldata a HashMap array of SQL car class data
     */
    void setClassList(HashMap[] cldata) {
        if(cldata == null || cldata.length == 0) {
            logger.log(Level.WARNING,"setClassList: null or 0 len hashmap");
        }
        boolean update = false;
        String[] oldActClasses = null;
        int cldatsize = cldata.length; // # of class records from table
        if (activeClasses == null){
            activeClasses = new String[cldatsize];
            update = true;
        }
        else if (!(cldatsize == activeClasses.length) )
        {
            update = true;
            oldActClasses = activeClasses;
            activeClasses = new String[cldatsize];
            clearClassList();
        }
        int idx = 0;
        for(int i = 0; i < cldatsize; i++) {
            if(cldata[i].get("mnemonic").equals("null") || cldata[i].get("mnemonic").equals("")) {
                if(debug) logger.log(Level.INFO,"setClassList: null mnemonic element"+
                    " in class list, element: {0}", i);
                continue;
            }
            //String[] vals = cldata[i].split(",");
            if(update) {
                activeClasses[idx] = (String)cldata[i].get("mnemonic");
            }
            if(idx < ClassListTable.getRowCount()) {
                ((javax.swing.table.DefaultTableModel)
                    ClassListTable.getModel()).removeRow(idx);
                ((javax.swing.table.DefaultTableModel)
                    ClassListTable.getModel()).insertRow(idx, new String[]{
                        (String)cldata[i].get("mnemonic"), (String)cldata[i].get("classname"),
                        (String)cldata[i].get("StartYear"), (String)cldata[i].get("EndYear")});
            }
            else {
                ((javax.swing.table.DefaultTableModel)
                    ClassListTable.getModel()).addRow(new String[]{
                        (String)cldata[i].get("mnemonic"), (String)cldata[i].get("classname"),
                        (String)cldata[i].get("StartYear"), (String)cldata[i].get("EndYear")});
            }
            idx++;
        }
        // clean up the classes table on delete, remove empty rows
        if(oldActClasses != null && oldActClasses.length > cldatsize) {
            // removed a class so remove empty rows from ClassListTable
            for(int i = 0; i < ClassListTable.getRowCount(); i++) {
                if(ClassListTable.getValueAt(i, 0).equals("")) {
                    ((javax.swing.table.DefaultTableModel)
                        ClassListTable.getModel()).removeRow(i);
                }
            }
        }
        
        if(debug) logger.log(Level.INFO,"setClassList: setting class table white");
        ClassListTable.setBackground(java.awt.Color.WHITE);
        ((myJTabbedPane)tabbedPane).clearActiveComponent(ClassListTable);
        ClassWait.setVisible(false);
        clearClassForm();
        repaint();
    }
    /*******************************************************************/
    /** Set the list of classes on the Car Class Admin panel.
     * This is the reply method used by the SqlClientReader to
     * populate the screen with SQL data from the DB.
     */
    @Deprecated
    void setClassList(String[] cldata) {
        if(cldata == null) { // if the class table data was null (empty class table or error)
            ClassListTable.setBackground(java.awt.Color.YELLOW);
        }
        else if(cldata.length == 1 && !cldata[0].contains(",")) {
            if(debug && cldata[0].equals("1")) {
                logger.log(Level.INFO,
                    "setClassList: update/add succeeded");
            }
            else if (Integer.parseInt(cldata[0]) < 0) {
                logger.log(Level.SEVERE, "setClassList: error ret: {0}", cldata[0]);
            }
            else {
                if(debug) logger.log(Level.WARNING, "setClassList: ret code: {0}", cldata[0]);
            }
        }
        else {
            boolean update = false;
            String[] oldActClasses = null;
            int cldatsize = cldata.length; // # of class records from table
            if (activeClasses == null){
                activeClasses = new String[cldatsize];
                update = true;
            }
            else if (!(cldatsize == activeClasses.length) )
            {
                update = true;
                oldActClasses = activeClasses;
                activeClasses = new String[cldatsize];
                clearClassList();
            }

            for(int i = 0; i < cldatsize; i++) {
                if(cldata[i].equals("null") || cldata[i].equals("") || !cldata[i].contains(",")) {
                    if(debug) logger.log(Level.INFO,"setClassList: null element"+
                        " or non SQL data in class list, element: {0}", i);
                    continue;
                }
                String[] vals = cldata[i].split(",");
                if(update) {
                    activeClasses[i] = vals[0];
                }
                if(i < ClassListTable.getRowCount()) {
                    ((javax.swing.table.DefaultTableModel)
                        ClassListTable.getModel()).removeRow(i);
                    ((javax.swing.table.DefaultTableModel)
                        ClassListTable.getModel()).insertRow(i, vals);
                }
                else {
                    ((javax.swing.table.DefaultTableModel)
                        ClassListTable.getModel()).addRow(vals);
            
                }
            }
            // clean up the classes table on delete, remove empty rows
            if(oldActClasses != null && oldActClasses.length > cldatsize) {
                // removed a class so remove empty rows from ClassListTable
                for(int i = 0; i < ClassListTable.getRowCount(); i++) {
                    if(ClassListTable.getValueAt(i, 0).equals("")) {
                        ((javax.swing.table.DefaultTableModel)
                            ClassListTable.getModel()).removeRow(i);
                    }
                }
            }
        }
        if(debug) logger.log(Level.INFO,"setClassList: setting class table white");
        ClassListTable.setBackground(java.awt.Color.WHITE);
        ((myJTabbedPane)tabbedPane).clearActiveComponent(ClassListTable);
        ClassWait.setVisible(false);
        clearClassForm();
        repaint();

    }
    /**
     * Generalized interface to the Judging Sheet form allowing passing of
     * an HashMap array.  Convenience class for consistent handling of DB results.
     * Since this is the judging sheet there should only be a single row if
     * more than one row is returned, subsequent values are ignored.
     * @param rs HashMap array of Sql results
     */
    private void setJudgingEntrant(HashMap[] rs) {
        if(rs == null || rs.length == 0) return;
        if(rs.length > 1) logger.log(Level.WARNING,"setJudgingEntrant: too many rows passed: {0}",rs.length);
        setJudgingEntrant(rs[0]);
    }
    /**
     * Set the values of the Entrant table on to the Judging Sheet panel.
     * @param sqlData HashMap values from the DB for this entrant
     */
    void setJudgingEntrant(HashMap sqlData) {
        newScoreEntry = false;
        //String[] vals = null;
        if(sqlData != null && !sqlData.isEmpty()) {
            //vals = sqlData[0].split(",");
            // correct if two awards values are empty/null
            if(sqlData.keySet().size() != 9) {
                logger.log(Level.SEVERE, "setJudgingEnt: too few columns returned:{0}", sqlData.keySet().size());
            }
            JS_EntrantNumber.setText(((String)sqlData.get("entrant_num")).trim());
            JS_EntrantMake.setText(((String)sqlData.get("make")).trim());
            JS_EntrantModel.setText(((String)sqlData.get("model")).trim());
            JS_ParkingNumber.setText(((String)sqlData.get("parking_loc")).trim());
            JS_EntrantColor.setText(((String)sqlData.get("color")).trim());
            JS_EntrantYear.setText(((String)sqlData.get("year")).trim());
            JS_EntrantClass.setText(((String)sqlData.get("mnemonic")).trim());
            if((String)sqlData.get("aw1") != null && !((String)sqlData.get("aw1")).equals("")) {
            //if(vals[7] != null && !vals[7].equals("")) {
                Iterator iter = AwardsBoxes.iterator();
                while(iter.hasNext()) {
                    JCheckBox c = (JCheckBox)iter.next();
                    if(c.getName().equals((String)sqlData.get("aw1")+"Box")) {
                    //if(c.getName().equals(vals[7])) {
                        c.setSelected(true);
                    }
                }
            }
            // this handles the corner case where an entry has won 2 awards
            // maximum awards per entrant remains 2 in this version
            if(sqlData.get("aw2") != null && 
                    !((String)sqlData.get("aw2")).equals("")) { // && 
                   //((String)sqlData.get("aw2")).equals("ParticipantChoiceBox")) {
                String award2 = (String)sqlData.get("aw2");
                Iterator it = AwardsBoxes.iterator();
                while(it.hasNext()) {
                    JCheckBox c = (JCheckBox)it.next();
                    if(c.getText().equals(award2))
                        c.setSelected(true);
                }
            }
            JS_BodyScore1.requestFocus();
        }
        else {
            if(debug) logger.log(Level.INFO,"setJudgingEnt: null/empty sqlData returned");
            clearJudgingSheet((byte)7); // clear whole form on null entrant data get
            JS_EntrantNumber.requestFocus();
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgeSheetPanel);
        judgingSheetWait.setVisible(false);
        judgingSheetWait.setEnabled(false);
        repaint();
    }
    /**
     * Set the entrant data on the Judging Sheet form.
     * @param sqlData the sql data to use in populating the form
     * Called by SqlClientReader to fill in the entrant data on the judging
     * sheet tab/pane/panel.
     */
    @Deprecated
    void setJudgingEntrant(String[] sqlData) {
        newScoreEntry = false;
        String[] vals = null;
        if(sqlData != null && sqlData.length > 0) {
            if(debug) logger.log(Level.INFO, "setJudgingEntrant: sqlData size:{0}", sqlData.length);
            if(sqlData.length > 1) 
                logger.log(Level.INFO,"setJudgingEnt: too many rows returned!");
            vals = sqlData[0].split(",");
            // correct if two awards values are empty/null
            if(vals.length != 9) { // # of cols requests
                if(debug) logger.log(Level.INFO, "setJudgingEnt: too few columns returned:{0}", vals.length);
                String[] tvals = new String[9];
                System.arraycopy(vals, 0, tvals, 0, vals.length);
                for(int k = vals.length; k < tvals.length; k++)
                    tvals[k] = "";
                vals = tvals;
            }
            if (vals != null && vals.length > 0) {
                // order of ret vals[]:
                // ent_num, make, model, parking, color, year, class
                JS_EntrantNumber.setText(vals[0].trim());
                JS_EntrantMake.setText(vals[1].trim());
                JS_EntrantModel.setText(vals[2].trim());
                JS_ParkingNumber.setText(vals[3].trim());
                JS_EntrantColor.setText(vals[4].trim());
                JS_EntrantYear.setText(vals[5].trim());
                JS_EntrantClass.setText(vals[6].trim());
                if(vals[7] != null && !vals[7].equals("")) {
                    Iterator iter = AwardsBoxes.iterator();
                    while(iter.hasNext()) {
                        JCheckBox c = (JCheckBox)iter.next();
                        if(c.getName().equals(vals[7])) {
                            c.setSelected(true);
                        }
                    }
                }
                // this handles the corner case where an entry has won 2 awards
                if(vals[8] != null && !vals[8].equals("") && vals[8].equals("ParticipantChoiceBox")) {
                   Award7Box.setSelected(true); 
                }
                JS_BodyScore1.requestFocus();
            }
        }
        else {
            if(debug) logger.log(Level.INFO,"setJudgingEnt: null/empty sqlData returned");
            clearJudgingSheet((byte)7); // clear whole form on null entrant data get
            JS_EntrantNumber.requestFocus();
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgeSheetPanel);
        judgingSheetWait.setVisible(false);
        repaint();
    }

    /**
     * Set the data for the scoring update on the Judging Sheet tab.  This
     * is a reply path from SqlClientReader() to populate the Judging Panel
     * with judging scores from the Scoring table.
     * @param sqlData an array of hashmaps, this is convenience method to
     * provide a cleaner interface to the version of this method which handles
     * a single hashmap object.
     */
    void setJudgingData(HashMap[] sqlData) {
        if(sqlData != null && sqlData.length > 0) {
           if(sqlData.length > 1) logger.log(Level.WARNING,
                   "set judging data, too many rows returned");
           setJudgingData(sqlData[0]);
        }
        else {
            newScoreEntry = true;
        }
    }
    /**
     * Set the data for the scoring update on the Judging Sheet tab.  This
     * is a db data handler to populate the Judging Panel
     * with judging scores from the Scoring table.  This is the expected/normal
     * path through which judging data is populated on the form.
     * @param sqlData the array of the scores for the requested entrant
     */
    void setJudgingData(HashMap sqlData) {
        if(sqlData != null && !sqlData.isEmpty()) {
            // verify that we have the data for the requested entrant
            if(JS_EntrantNumber.getText().equals((String)sqlData.get("entrant_num"))) {
                if(!((String)sqlData.get("Judge1")).trim().equals("null"))
                    JS_JudgeInitials1.setText(((String)sqlData.get("Judge1")).trim());
                if(!((String)sqlData.get("Judge2")).trim().equals("null"))
                    JS_JudgeInitials2.setText(((String)sqlData.get("Judge2")).trim());
                if(!((String)sqlData.get("j1_cat1")).trim().equals("null"))
                    JS_BodyScore1.setText(((String)sqlData.get("j1_cat1")).trim());
                if(!((String)sqlData.get("j1_cat2")).trim().equals("null"))
                    JS_EngineScore1.setText(((String)sqlData.get("j1_cat2")).trim());
                if(!((String)sqlData.get("j1_cat3")).trim().equals("null"))
                    JS_InteriorScore1.setText(((String)sqlData.get("j1_cat3")).trim());
                if(!((String)sqlData.get("j1_cat4")).trim().equals("null"))
                    JS_ChassisScore1.setText(((String)sqlData.get("j1_cat4")).trim());
                if(!((String)sqlData.get("j1_cat5")).trim().equals("null"))
                    JS_TireScore1.setText(((String)sqlData.get("j1_cat5")).trim());
                if(!((String)sqlData.get("j1_cat6")).trim().equals("null"))
                    JS_WheelsScore1.setText(((String)sqlData.get("j1_cat6")).trim());
                // vals[9] = judge#1 total
                if(!((String)sqlData.get("j2_cat1")).trim().equals("null")) 
                    JS_BodyScore2.setText(((String)sqlData.get("j2_cat1")).trim());
                if(!((String)sqlData.get("j2_cat2")).trim().equals("null")) 
                    JS_EngineScore2.setText(((String)sqlData.get("j2_cat2")).trim());
                if(!((String)sqlData.get("j2_cat3")).trim().equals("null")) 
                    JS_InteriorScore2.setText(((String)sqlData.get("j2_cat3")).trim());
                if(!((String)sqlData.get("j2_cat4")).trim().equals("null")) 
                    JS_ChassisScore2.setText(((String)sqlData.get("j2_cat4")).trim());
                if(!((String)sqlData.get("j2_cat5")).trim().equals("null")) 
                    JS_TireScore2.setText(((String)sqlData.get("j2_cat5")).trim());
                if(!((String)sqlData.get("j2_cat6")).trim().equals("null")) 
                    JS_WheelsScore2.setText(((String)sqlData.get("j2_cat6")).trim());
                // vals[16] = judge#2 total
                Iterator<javax.swing.JTextField> fiter = JudgingFields.iterator();
                int fcnt = 0;
                while(fiter.hasNext()) {
                    javax.swing.JTextField c = fiter.next();
                    if(c.getText().equals("0")) {
                        if (fcnt > 5 && JS_JudgeInitials2.getText().equals("") ||
                            fcnt < 6 && JS_JudgeInitials1.getText().equals(""))
                                c.setText("");
                    }
                    fcnt++;
                }
            }
            else 
                logger.log(Level.INFO,"setJudgingData: Data for wrong entrant returned!!!");
            newScoreEntry = false;
        }
        else {
            newScoreEntry = true; // Score DB was empty - guaranteed
            // null sqlData == empty set/ no data for this entrant in Scoring
            // check if the entrant data get was also empty (bad entrant# case)
            if(JS_EntrantNumber.getText().equals("")) {
                clearJudgingSheet((byte)7);
                JS_EntrantNumber.requestFocus();
                currentJudgingEntrant = null;
            }
            else {
                currentJudgingEntrant = JS_EntrantNumber.getText();
                JS_BodyScore1.requestFocus();
            }
            JS_SaveButton.setForeground(java.awt.Color.BLACK);
        }
        awardsChanged = false;
        if(JS_EntrantNumber.getText().equals(""))
            JS_EntrantNumber.requestFocus();
        ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgeSheetSubPanel);
        judgingSheetWait.setVisible(false);
        repaint();
    }
    /**
     * Set the data for the scoring update on the Judging Sheet tab.  This
     * is a reply path from SqlClientReader() to populate the Judging Panel
     * with judging scores from the Scoring table.
     * @param sqlData the array of the scores for the requested entrant
     */
    @Deprecated
    void setJudgingData(String[] sqlData) {
        String vals[] = null;
        if(sqlData != null && sqlData.length > 0) { // partial or full results
            if(sqlData.length > 1)
                if(debug) logger.log(Level.INFO, "setJudgingData: too many rows returned: {0}", sqlData.length);
            if(!sqlData[0].contains(",") && checkNum(sqlData[0].trim())) {
                // handle update ret code from DB, insert & update both
                logger.log(Level.INFO, "setJudDat: ret val rcvd: {0}", sqlData[0]);
                int ret = new Integer(sqlData[0]).intValue();
                if(ret == 1) {
                    if(debug) logger.log(Level.INFO,"setJudgingData: return code recvd");
                    newScoreEntry = false;
                    judgingSheetWait.setVisible(false);
                    ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgeSheetSubPanel);
                    JS_SaveButton.setForeground(java.awt.Color.RED);
                    if(debug) System.out.println("Judging data update success");
                }
                else {
                    logger.log(Level.ALL, "setJudgingData: unexpected ret code: {0}", ret);
                }
            }
            else { // SQL Get results in CSV form returned from DB populate form
                vals = sqlData[0].split(",");
                if(vals.length != 17) { // fix too few rows
                    if(debug) logger.log(Level.INFO, "setJudgingData: wrong # of cols: {0}", vals.length);
                    String[] nvals = new String[17];
                    System.arraycopy(vals, 0, nvals, 0, vals.length);
                    for(int i = vals.length; i < nvals.length; i++)
                        nvals[i] = "";
                    vals = nvals;
                }
                else if(vals != null && vals.length > 0) {
                    // populate scoring data from result set
                    if(JS_EntrantNumber.getText().equals(vals[0])) {
                        if(!vals[1].trim().equals("null")) 
                            JS_JudgeInitials1.setText(vals[1].trim());
                        if(!vals[2].trim().equals("null")) JS_JudgeInitials2.setText(vals[2].trim());
                        if(!vals[3].trim().equals("null")) JS_BodyScore1.setText(vals[3].trim());
                        if(!vals[4].trim().equals("null")) JS_EngineScore1.setText(vals[4].trim());
                        if(!vals[5].trim().equals("null")) JS_InteriorScore1.setText(vals[5].trim());
                        if(!vals[6].trim().equals("null")) JS_ChassisScore1.setText(vals[6].trim());
                        if(!vals[7].trim().equals("null")) JS_TireScore1.setText(vals[7].trim());
                        if(!vals[8].trim().equals("null")) JS_WheelsScore1.setText(vals[8].trim());
                        // vals[9] = judge#1 total
                        if(!vals[10].trim().equals("null")) JS_BodyScore2.setText(vals[10].trim());
                        if(!vals[11].trim().equals("null")) JS_EngineScore2.setText(vals[11].trim());
                        if(!vals[12].trim().equals("null")) JS_InteriorScore2.setText(vals[12].trim());
                        if(!vals[13].trim().equals("null")) JS_ChassisScore2.setText(vals[13].trim());
                        if(!vals[14].trim().equals("null")) JS_TireScore2.setText(vals[14].trim());
                        if(!vals[15].trim().equals("null")) JS_WheelsScore2.setText(vals[15].trim());
                        // vals[16] = judge#2 total
                        Iterator<javax.swing.JTextField> fiter = JudgingFields.iterator();
                        int fcnt = 0;
                        while(fiter.hasNext()) {
                            javax.swing.JTextField c = fiter.next();
                            if(c.getText().equals("0")) {
                                if (fcnt > 5 && JS_JudgeInitials2.getText().equals("") ||
                                    fcnt < 6 && JS_JudgeInitials1.getText().equals(""))
                                        c.setText("");
                            }
                            fcnt++;
                        }
                    }
                    else
                        logger.log(Level.INFO,"setJudgingData: Data for wrong entrant returned!!!");
                }
                newScoreEntry = false;
            }
        }
        else { // null || zero-length sqlData
            newScoreEntry = true; // Score DB was empty - guaranteed
            // null sqlData == empty set/ no data for this entrant in Scoring
            // check if the entrant data get was also empty (bad entrant# case)
            if(JS_EntrantNumber.getText().equals("")) {
                clearJudgingSheet((byte)7);
                JS_EntrantNumber.requestFocus();
                currentJudgingEntrant = null;
            }
            else {
                currentJudgingEntrant = JS_EntrantNumber.getText();
                JS_BodyScore1.requestFocus();
            }
            JS_SaveButton.setForeground(java.awt.Color.BLACK);
        }
        awardsChanged = false;
        if(JS_EntrantNumber.getText().equals(""))
            JS_EntrantNumber.requestFocus();
        ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgeSheetSubPanel);
        judgingSheetWait.setVisible(false);
        repaint();
    }
    /**
     * set the values displayed on the Judging panel when the periodic timer
     * fires.  The companion mechanism that performs the periodic Sql request
     * is the judgingReport() method.  This is the mechanism that provides
     * judging status reports.
     * @param sqlData sql data retrieved for the judging status report
     */
    void setJudgePanel(HashMap[] sqlData) {
        javax.swing.table.DefaultTableModel dm = (javax.swing.table.DefaultTableModel)CarScores.getModel();
        dm.getDataVector().removeAllElements();
        if(sqlData == null || sqlData.length == 0) {
            if(debug) logger.log(Level.INFO,"setJudgePanel: sql data null/empty");
        }
        else {
            for(int i = 0; i < sqlData.length; i++) {
                
                if(sqlData[i].keySet().size() == 12) {
                    String[] mvals = new String[9];
                    mvals[0] = (String)sqlData[i].get("entrant_num"); // reg num
                    mvals[1] = (String)sqlData[i].get("mnemonic"); // class
                    mvals[2] = (String)sqlData[i].get("fname")+" "+(String)sqlData[i].get("lname"); //fname lname
                    mvals[3] = (String)sqlData[i].get("year")+
                            " "+(String)sqlData[i].get("make")+
                            " "+(String)sqlData[i].get("model"); // year make model
                    mvals[4] = (String)sqlData[i].get("Judge1"); // judge 1
                    mvals[5] = (String)sqlData[i].get("j1_total"); // score 1
                    mvals[6] = (String)sqlData[i].get("Judge2"); // judge2
                    mvals[7] = (String)sqlData[i].get("j2_total"); // score2
                    if(sqlData[i].get("printed") == null || ((String)sqlData[i].get("printed")).equals("null"))
                        mvals[8] = "";
                    else mvals[8] = (String)sqlData[i].get("printed"); // printed
                    ((javax.swing.table.DefaultTableModel)CarScores.getModel()).addRow(mvals);
                }
                else {
                    logger.log(Level.INFO, "setJudgePanel: wrong # cols: {0}", sqlData[i].entrySet().size());
                    //logger.log(Level.INFO, "setJudgePanel: rcvd sqlData[0]: {0}", sqlData[0]);
                } 
            } 
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgingPanel);
        JudgingWait.setVisible(false);
        JudgingWait.setEnabled(false);
        repaint();
    }
    /**
     * Reply path for SqlClientReader involving the JudgingPanel where the
     * status of all entrants judging is viewed on a periodic timer.
     * @param sqlData strings array containing the judging data from the DB.
     */
    @Deprecated
    void setJudgePanel(String[] sqlData) {
        String[] vals;
        //int rowidx = 0;
        javax.swing.table.DefaultTableModel dm = (javax.swing.table.DefaultTableModel)CarScores.getModel();
        dm.getDataVector().removeAllElements();
        if(sqlData == null) {
            if(debug) logger.log(Level.INFO,"setJudgePanel: sql data null");
        }
        else if (sqlData.length == 1 && !sqlData[0].contains(",")) {
            if(debug) logger.log(Level.INFO, "setJudgePanel: ret code recvd: {0}", sqlData[0]);
        }
        else {
            for(int i = 0; i < sqlData.length; i++) {
                vals = sqlData[i].split(",");
                if(vals.length != 12) {
                    String[] nvals = new String[12];
                    System.arraycopy(vals,0,nvals,0,vals.length);
                    for(int k = 0; k < nvals.length; k++)
                        nvals[k] = "";
                    vals = nvals;
                }
                if(vals.length == 12) {
                    String[] mvals = new String[9];
                    mvals[0] = vals[0]; // reg num
                    mvals[1] = vals[1]; // class
                    mvals[2] = vals[2]+" "+vals[3]; //fname lname
                    mvals[3] = vals[4]+" "+vals[5]+" "+vals[6]; // year make model
                    mvals[4] = vals[7]; // judge 1
                    mvals[5] = vals[8]; // score 1
                    mvals[6] = vals[9]; // judge2
                    mvals[7] = vals[10]; // score2
                    if(vals[11].equals("null"))
                        mvals[8] = "";
                    else mvals[8] = vals[11]; // printed
                    ((javax.swing.table.DefaultTableModel)CarScores.getModel()).addRow(mvals);
                } 
                else {
                    logger.log(Level.INFO, "setJudgePanel: wrong # cols: {0}", vals.length);
                    logger.log(Level.INFO, "setJudgePanel: rcvd sqlData[0]: {0}", sqlData[0]);
                } 
            } 
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(JudgingPanel);
        JudgingWait.setVisible(false);
        repaint();
    }
    /**
     * set the EntrantClass comboBox on the Registration panel.  This gives
     * the capability to select the class by letter(s)
     * @param c 
     */
    private void setClass(String c) {
        if(c.equals("")) {
            EntrantClass.setSelectedItem("");
        }
        else {
            for(int i = 0; i < EntrantClass.getItemCount(); i++) {
                String ss = (String)EntrantClass.getItemAt(i);
                if(ss.equals("")) continue;
                ss = ss.substring(0,ss.indexOf(" "));
                if(ss.equals(c)) {
                    EntrantClass.setSelectedIndex(i);
                    break;
                }
            }
        }
    }
    /**
     * Clears the Classes Setup Panel ClassListTable contents.
     */
    private void clearClassList() {
        int nrows = ClassListTable.getRowCount();
        int ncols = ClassListTable.getColumnCount();
        for (int i = 0; i < nrows; i++) {
            for (int j = 0; j < ncols; j++)
                ClassListTable.setValueAt("", i, j);
        }
        resetClassTable();
    }
    

    /**
     * Clear the Class Setup panel input fields.
     */
    private void clearClassForm() {
        NewClassMnemonic.setText("");
        NewClassName.setText("");
        NewClassStartYear.setText("");
        NewClassEndYear.setText("");
    }

    /**
     * Wrapper of the class table initializer used by SqlClientReader object
     * as well as within the UI class to clear the Class Setup panel.
     * 
     */
     void resetClassTable() {
         // TODO: these two operations may not be required in latest design...
         ((myJTabbedPane)tabbedPane).clearActiveComponent(ClassListTable);
         ClassWait.setVisible(false);
         initClassTable();
     }

     /**
      * Clear the Judging Sheet panel form input fields.
      * @param segment defines the segment to erase in a bit-wise scheme
      * where 0x1 = clears entrant data
      *       0x2 = clears judge #1 data
      *       0x4 = clears judge #2 data
      *       0x7 = clear entrant, judge #1, judge #2 data
      */
    private void clearJudgingSheet(byte segment) {
        if((segment & 0x01) == 0x01) {
            JS_EntrantNumber.setText("");
            JS_ParkingNumber.setText("");
            JS_EntrantMake.setText("");
            JS_EntrantModel.setText("");
            JS_EntrantYear.setText("");
            JS_EntrantColor.setText("");
            JS_EntrantClass.setText("");
           if(AwardsBoxes != null) {
               Iterator iter = AwardsBoxes.iterator();
               while(iter.hasNext()) {
                   ((JCheckBox)iter.next()).setSelected(false);
               }
           }
           newScoreEntry = true;
        }
        if((segment & 0x02) == 0x02) {
            // judge #1 data clears when segment > 0
            JS_BodyScore1.setText("");
            JS_EngineScore1.setText("");
            JS_InteriorScore1.setText("");
            JS_ChassisScore1.setText("");
            JS_TireScore1.setText("");
            JS_WheelsScore1.setText("");
            JS_JudgeInitials1.setText("");
        }
        if((segment & 0x04) == 0x04) {
        //if(segment > 1) {
            // judge #2 data clears when segment > 1
            JS_BodyScore2.setText("");
            JS_EngineScore2.setText("");
            JS_InteriorScore2.setText("");
            JS_ChassisScore2.setText("");
            JS_TireScore2.setText("");
            JS_WheelsScore2.setText("");
            JS_JudgeInitials2.setText("");
        }
        repaint();
    }
    
    /**
     * This asks for the SpecialAwards hashMap to be populated from the DB.
     * This information will guide the parsing of the entered data on the
     * Judging Sheet panel, while this is clunky, it does afford us the ability
     * to poll this information immediately before we would apply an award to
     * a user, thus minimizing a race conditions that exists by the network
     * architecture.
     */
    private void setSpecialAwards() {
        if(SpecialAwards == null) SpecialAwards = new java.util.HashMap<String,String>();
        String request = "select * from Specials;";
        judgingSheetWait.setVisible(true);
        //sqlGet(specialtyAwardsLabel, request);
        //waitForIt(judgingSheetWait);
        //    if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
        //    else JS_SaveButton.setForeground(java.awt.Color.BLACK);
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) updateSpecialAwards(rs);
        JS_SaveButton.setForeground(java.awt.Color.BLACK);
    }
    
    /**
     * DB data handling method called by setSpecialAwards() from Specials table
     * data request.  A copy of the awarded "Special Awards" is kept on
     * the client and referred to when an attempt is made to assign an
     * award to a particular entrant.  If the award already exists in this table
     * then we treat it as already awarded.  
     * A potential race condition exists if two
     * clients have Judging Sheets active and one updates and another updates
     * without refreshing (tabbing away and back into the Judging Sheet panel)
     * thus requesting a current look at the Specials table data.
     * @param args 
     */
    void updateSpecialAwards(HashMap[] args) {
        if(this.SpecialAwards == null) this.SpecialAwards = new HashMap<String,String>();
        if(args == null) {
            this.SpecialAwards.clear();
        }
        else {
            if(AwardsShared == null) { // init on first use here
                AwardsShared = new HashMap<String,String>();
            }
            if(args.length > 0) {
                this.SpecialAwards.clear();
                for(int i = 0; i < args.length; i++) {
                    this.SpecialAwards.put(((String)args[i].get("award")).trim(), ((String)args[i].get("entrant_num")).trim());
                    this.AwardsShared.put(((String)args[i].get("award")).trim(),(String)args[i].get("canshare"));
                }
            }
            else { // this should be the case if we delete all results?
               logger.log(Level.INFO,"updSpecAwards: empty return, treat as empty Specials table");
               if(!this.SpecialAwards.isEmpty()) {
                   this.SpecialAwards.clear();
                   this.AwardsShared.clear();
               }
            }
        }
        if(judgingSheetWait != null) judgingSheetWait.setVisible(false);
        repaint();
        if(JS_SaveButton != null) {
            if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
            else JS_SaveButton.setForeground(java.awt.Color.BLACK);
        }
    }
    
    /**
     * Here is the reply path from SqlClientReader when a setSpecialAwards()
     * request is made.  A copy of the awarded "Special Awards" is kept on
     * the client and referred to when an attempt is made to assign an
     * award to a particular entrant.  If the award already exists in this table
     * then we treat it as already awarded.  The race condition exists if two
     * clients have Judging Sheets active and one updates and another updates
     * without refreshing (tabbing away and back into) the Judging Sheet panel
     * thus requesting a current look at the Specials table data.
     */
    @Deprecated
    void updateSpecialAwards(String[] args) {
        if(args == null) {
            SpecialAwards.clear(); // DB is empty
        }
        else {
            if(args.length > 0 && args[0].contains(",")) {
                SpecialAwards.clear();
                for(int i = 0; i < args.length; i++) {
                    String[] vals = args[i].split(",");
                    SpecialAwards.put(vals[0].trim(), vals[1].trim());
                }
            }
            else if(args.length == 1) {
               // return code
                if(debug) logger.log(Level.INFO, "updSpecAwards: db ret code {0}", args[0]);          
            }
            else { // this should be the case if we delete all results?
               if(debug) logger.log(Level.INFO,"updSpecAwards: empty return, treat as empty Specials table");
               if(!SpecialAwards.isEmpty()) {
                   SpecialAwards.clear();
               }
            }
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(specialtyAwardsLabel);
        judgingSheetWait.setVisible(false);
        repaint();
        if(!failedWait) JS_SaveButton.setForeground(java.awt.Color.RED);
        else JS_SaveButton.setForeground(java.awt.Color.BLACK);
    }
    /*
     * current copy of the Entrants table data saved as a CSV file
     * by the setAwardsSaveResult() method.
     */
    private HashMap<String, Boolean> savedTables = null;
    
    /**
     * DB data handler that response to the save results button on the Awards
     * Panel.  Expected data is an array of hashmaps that contain the Entrant
     * table data.
     * @param ret SQL data to be saved to the output file.
     */
    void setAwardsSaveResult(HashMap[] ret) {
        if(ret != null) {
            if(savedTables == null)
                savedTables = new HashMap();
            if(ret.length > 0) {
                // this.saveTable contains the name of the table being saved
                if(debug) {
                    logger.log(Level.INFO, "DB save awards result for {0} size: {1}",
                        new Object[]{this.saveTable, ret.length});
                }

                java.io.FileWriter eout = null;
                try {
                    eout = new java.io.FileWriter(this.saveTable+".csv");
                    java.io.BufferedWriter fw = new java.io.BufferedWriter(eout);
                    for(int i =  0; i < ret.length; i++) {
                        StringBuilder str = new StringBuilder();
                        if(this.saveTable.equals("entrants")) {
                            str.append((String)ret[i].get("entrant_num"));
                            str.append(",");
                            str.append((String)ret[i].get("mnemonic"));
                            str.append(",");
                            str.append((String)ret[i].get("fname"));
                            str.append(",");
                            str.append((String)ret[i].get("lname"));
                            str.append(",");
                            str.append((String)ret[i].get("address"));
                            str.append(",");
                            str.append((String)ret[i].get("city"));
                            str.append(",");
                            str.append((String)ret[i].get("state"));
                            str.append(",");
                            str.append((String)ret[i].get("zip"));
                            str.append(",");
                            str.append((String)ret[i].get("phone"));
                            str.append(",");
                            str.append((String)ret[i].get("make"));
                            str.append(",");
                            str.append((String)ret[i].get("model"));
                            str.append(",");
                            str.append((String)ret[i].get("color"));
                            str.append(",");
                            str.append((String)ret[i].get("year"));
                            str.append(",");
                            str.append((String)ret[i].get("parking_loc"));
                            str.append(",");
                            str.append((String)ret[i].get("club"));
                            str.append(",");
                            str.append(","); // leave preg unset
                            str.append(","); // leave printed unset
                            str.append((String)ret[i].get("aw1"));
                            str.append(",");
                            str.append((String)ret[i].get("aw2"));
                            str.append("\n");
                        }
                        else if(this.saveTable.equals("clubs")) {
                            str.append((String)ret[i].get("club"));
                            str.append("\n");
                        }
                        else if(this.saveTable.equals("scoring")) {
                            str.append("entrant_num");
                            str.append(",");
                            str.append((String)ret[i].get("Judge1"));
                            str.append(",");
                            str.append((String)ret[i].get("Judge2"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_cat1"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_cat2"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_cat3"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_cat4"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_cat5"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_cat6"));
                            str.append(",");
                            str.append((String)ret[i].get("j1_total"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_cat1"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_cat2"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_cat3"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_cat4"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_cat5"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_cat6"));
                            str.append(",");
                            str.append((String)ret[i].get("j2_total"));
                            str.append(",");
                            str.append("\n");
                        }
                        else if(this.saveTable.equals("archive")) {
                            str.append((String)ret[i].get("fname"));
                            str.append(",");
                            str.append((String)ret[i].get("lname"));
                            str.append(",");
                            str.append((String)ret[i].get("address"));
                            str.append(",");
                            str.append((String)ret[i].get("city"));
                            str.append(",");
                            str.append((String)ret[i].get("state"));
                            str.append(",");
                            str.append((String)ret[i].get("zip"));
                            str.append(",");
                            str.append((String)ret[i].get("phone"));
                            str.append("\n");
                        }
                        fw.write(str.toString());
                        fw.flush();
                    }
                    fw.close();
                    savedTables.put(saveTable,true);
                } catch (IOException ex) {
                    logger.log(Level.SEVERE, "IOException saving "+saveTable+".csv file", ex);
                }
            }
            else {
                logger.log(Level.INFO, "zero length table save result, saveTable: {0}", saveTable);
                savedTables.put(saveTable,false);
            }
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(ReportTable);
        AwardsWait.setVisible(false);
        if(savedTables.size() == 3) {
            if(savedTables.get(CarShowConstants.winEntrants) &
                savedTables.get(CarShowConstants.winClubs) &
                savedTables.get(CarShowConstants.winScoring)) {
                    AwardsSaveResultsButton.setForeground(java.awt.Color.RED);
                    savedTables = null; // reset for reprint
            }
        }
    }
    
    /**
     * This is the reply path for the save results button on the Awards Panel.
     * The Save button will change color once a save has been done.
     */
    @Deprecated
    private void setAwardsSaveResult(String[] ret) {
        if(ret == null) {
            if(debug) logger.log(Level.INFO,"setAwardsSaveResult: null ret probably OK");
        }
        else {
            if(savedTables == null) {
                savedTables = new HashMap();
            }
            if(ret.length > 0) {
                if(debug) {
                    logger.log(Level.INFO, "DB save awards result for {0} size: {1}",
                        new Object[]{this.saveTable, ret.length});
                }
                // Unwind the result set, because of the way we capture it
                // in sqlGet(), we need to reverse the order here
                java.io.FileWriter eout = null;
                try {
                    eout = new java.io.FileWriter(this.saveTable+".csv");
                    java.io.BufferedWriter fw = new java.io.BufferedWriter(eout);
                    for(int i =  ret.length-1; i > 0; i--) {
                        fw.write(ret[i]+"\n");
                        fw.flush();
                    }
                    fw.close();
                    savedTables.put(this.saveTable,true);
                } catch (IOException ex) {
                    logger.log(Level.SEVERE, "IOException saving "+saveTable+".csv file", ex);
                }
            }
            else {
                logger.log(Level.INFO, "zero length table save result, saveTable: {0}", saveTable);
                savedTables.put(this.saveTable,false);
            }
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(ReportTable);
        AwardsWait.setVisible(false);
        if(savedTables.size() == 3) {
            if(savedTables.get(CarShowConstants.winEntrants) &
                savedTables.get(CarShowConstants.winClubs) &
                savedTables.get(CarShowConstants.winScoring)) {
                    AwardsSaveResultsButton.setForeground(java.awt.Color.RED);
                    savedTables = null; // reset for reprint
            }
        }
    }
    
    /**
     * Set the name of the car show in the database.
     * @param s car show name string to be used
     * @return true if update succeeded
     */
    private boolean updateContestName(String s) {
        String request = "UPDATE "+CarShowConstants.winShowData+" SET "+
            "showname=\""+s+"\";";
        boolean result = (execDBUpdate(request) > 0) ? true : false;
        if(!result) {
            logger.log(Level.WARNING,"update contest name failed, request: {0}",request);
        }
        return result;
    }
    /**
     * Set the date of show value in the database.
     * @param d date string to be used
     * @return true if update succeeded
     */
    private boolean updateContestDate(String d) {
        String request = "UPDATE "+CarShowConstants.winShowData+" SET "+
            " showdate=\""+d+"\";";
        boolean result = (execDBUpdate(request) > 0) ? true : false;
        if(!result) {
            logger.log(Level.WARNING,"update contest date failed, request: {0}",request);
        }
        return result;
    }
    
    /*
     * convenience method to handle the normal output format of getDBData()
     * requests and provide the correct input to the actual showdata table
     * handler of the same name.
     * @param ret array of hashmaps containing showdata table data, 1 row expected
     */
    void setContestResult(HashMap[] ret) {
        if(ret != null && ret.length > 0) {
            if(ret.length > 1) logger.log(Level.WARNING,
                "too many rows returned from showdata table request: {0}",ret.length);
            setContestResult(ret[0]);
        }
    }
    /**
     * Populate the Administration panel show information from the ShowData
     * table.
     * @param ret 
     */
    void setContestResult(HashMap ret) {
        // The original setContestResult() also handled the return code which
        // is now being handled in the execDBUpdate() method which will wrap
        // these requests in the new (MySQL) design. -wdm
        if(ret == null || ret.isEmpty()) return;
        String laddr = getLocalIP();
        if(ret.containsKey("showname")) {
            String nshowname = (String)ret.get("showname");
            if(this.CurrentCarShowName == null ||
                    (this.CurrentCarShowName != null && 
                    !this.CurrentCarShowName.equals(nshowname))) {
                this.CurrentCarShowName = nshowname;
            }
            ContestName.setText(CurrentCarShowName);
        }
        if(ret.containsKey("showdate")) {
            String ndate = (String)ret.get("showdate");
            if(this.CarShowDate == null ||
                    (this.CarShowDate != null &&
                    !this.CarShowDate.equals(ndate))) {
                this.CarShowDate = ndate;
            }
            ndate = ndate.replaceAll("~ ",", "); // ~ replaces ,
            ShowDate.setText(ndate);
        }
        if(ret.containsKey("location")) {
            ShowLocation.setText((String)ret.get("location"));
        }
        else
            ShowLocation.setText("");
        
        ((myJTabbedPane)tabbedPane).clearActiveComponent(AdminPanel);
        AdminWait.setVisible(false);
        AdminWait.setEnabled(false);
    }
    /**
     * Reply path from ClientReader when Admin data is changed in the ShowData
     * table.  
     * @param ret 
     */
    @Deprecated
    void setContestResult(String ret) {
        if(debug) logger.log(Level.INFO, "setContestRes: input str = {0}", ret);
        if(ret != null && ret.length() > 0) {
            if(ret.contains(",")) { // table data for Admin panel
                String[] vals = ret.split(",");
                if(vals.length < 2) {
                    String[] nvals = new String[2];
                    System.arraycopy(vals, 0, nvals, 0, nvals.length);
                    nvals[1] = "";
                    vals = nvals;
                }
                vals[1] = vals[1].replaceAll("~ ",", "); // ~ replaces , CarShowDate
                String laddr = getLocalIP();
                if(this.CurrentCarShowName != null && !this.CurrentCarShowName.equals(vals[0])) {
                    if(this.SQLServer.equals("localhost") || this.SQLServer.equals(laddr)) {
                        // localhost means preferences override DB
                        updateContestName(this.CurrentCarShowName);
                    }
                }
                else {
                    this.CurrentCarShowName = vals[0];
                }
                ContestName.setText(CurrentCarShowName);
                if(this.CarShowDate != null && !this.CarShowDate.equals(vals[1])) {
                    if(this.SQLServer.equals("localhost") || this.SQLServer.equals(laddr)) {
                        updateContestDate(this.CarShowDate);
                    }
                }
                else {
                    this.CarShowDate = vals[1];
                }
                ShowDate.setText(vals[1]);
                if(!vals[2].isEmpty()) { // Carshow location
                    this.ShowLocation.setText(vals[2]);
                }
                else {
                    this.ShowLocation.setText("");
                }
            }
            else { // ret code from update/delete
                if(Integer.parseInt(ret) == 0) {
                    // DB table for show name & date is empty reflect this
                    // on the forms
                    ContestName.setText("");
                    CurrentCarShowName = null;
                    ShowDate.setText("");
                }
                else if (Integer.parseInt(ret) >= 1) {
                    //ContestName.setText("");
                    CurrentCarShowName = ContestName.getText();
                    CarShowDate = ShowDate.getText();
                    // UPDATE Preferences on form change?
                }
                if(Integer.parseInt(ret) < 0) {
                    logger.log(Level.SEVERE, "setContestResult: a DB operation failed");
                }
            }
        }
        ((myJTabbedPane)tabbedPane).clearActiveComponent(AdminPanel);
        AdminWait.setVisible(false);
        AdminWait.setEnabled(false);
    }

    /**
     * clear the local view of the active car classes and car clubs.  These tables
     * are less important than they were and may be deprecated in later designs.
     */
    private void clearLocalTables() {
        if(activeClasses != null) activeClasses = null;
        if(EntrantClass.getItemCount() > 0) {
            javax.swing.DefaultComboBoxModel cbm = 
                (javax.swing.DefaultComboBoxModel)EntrantClass.getModel();
            cbm.removeAllElements();
        }
        if(activeClubs != null) activeClubs = null;
        if(EntrantClub.getItemCount()>0) {
            javax.swing.DefaultComboBoxModel cbm = 
                (javax.swing.DefaultComboBoxModel)EntrantClub.getModel();
            cbm.removeAllElements();
        }
    }
    /**
     * This initializes a HashMap object mapping DB field names to Registration panel
     * input fields (mostly JTextField but one is a JComboBox)  for performing
     * the search functionality.  Order is somewhat less important here because
     * we will evaluate if each is set non empty and use it to form the
     * query string sent.
     */
    private void setEntrantFieldsList() {
        EntrantFields = new java.util.HashMap<String, javax.swing.JComponent>();
        EntrantFields.put("entrant_num",EntrantNumber);
        EntrantFields.put("fname", FirstName);
        EntrantFields.put("lname", LastName);
        EntrantFields.put("mnemonic", EntrantClass);
        EntrantFields.put("club", EntrantClub);
        EntrantFields.put("address", EntrantAddress);
        EntrantFields.put("city", EntrantCity);
        EntrantFields.put("state", EntrantState);
        EntrantFields.put("phone", EntrantPhone);
        EntrantFields.put("parking_loc", EntrantParking);
        EntrantFields.put("year", EntrantYear);
        EntrantFields.put("make", EntrantMake);
        EntrantFields.put("model", EntrantModel);
        EntrantFields.put("color", EntrantColor);
    }

    /**
     * This initializes an ordered list of the judge scoring fields.  The
     * list is then used to inquire the contents of these fields in an
     * automated way.  This permits a concise yet robust algorithm in the
     * judging sheet panel entered data analysis.  The LinkedList allows
     * the control of order, which is desirable when reading that form.
     */
    private void setJudgeSheetList() {
        JudgingFields = new java.util.LinkedList();
        JudgingFields.add(JS_BodyScore1);
        JudgingFields.add(JS_EngineScore1);
        JudgingFields.add(JS_InteriorScore1);
        JudgingFields.add(JS_ChassisScore1);
        JudgingFields.add(JS_TireScore1);
        JudgingFields.add(JS_WheelsScore1);
        JudgingFields.add(JS_BodyScore2);
        JudgingFields.add(JS_EngineScore2);
        JudgingFields.add(JS_InteriorScore2);
        JudgingFields.add(JS_ChassisScore2);
        JudgingFields.add(JS_TireScore2);
        JudgingFields.add(JS_WheelsScore2);
    }
    
    /**
     * Initializes the AwardsBoxes LinkList object so various parts of
     * the code can iterate over the award check boxes of the Judging Sheet
     * panel where scores are entered.
     */
    private void setAwardsButtonList() {
        AwardsBoxes = new java.util.LinkedList<javax.swing.JCheckBox>();
        AwardsBoxes.add(Award1Box);
        AwardsBoxes.add(Award2Box);
        AwardsBoxes.add(Award3Box);
        AwardsBoxes.add(Award4Box);
        AwardsBoxes.add(Award5Box);
        AwardsBoxes.add(Award6Box);
        AwardsBoxes.add(Award7Box);
        AwardsBoxes.add(Award8Box);
        AwardsBoxes.add(Award9Box);
        AwardsBoxes.add(Award10Box);
        AwardsBoxes.add(Award11Box);
        AwardsBoxes.add(Award12Box);
        AwardsBoxes.add(Award13Box);
        AwardsBoxes.add(Award14Box);
        AwardsBoxes.add(Award15Box);
        AwardsBoxes.add(Award16Box);
    }
    
    /**
     * Format the judging status results table showing the show winners list.
     * 
     */
    
    private void formatJudgingTable() {
        javax.swing.table.DefaultTableCellRenderer centerRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment( javax.swing.JLabel.CENTER );
        javax.swing.table.TableColumn column = null;
        for (int i = 0; i < CarScores.getColumnModel().getColumnCount(); i++) {
            column = CarScores.getColumnModel().getColumn(i);
            if (i == 0) {// registration # - narrow
                column.setCellRenderer(centerRenderer);
                column.setMaxWidth(70);
            }
            else if (i == 1) { // class mnemonic field - narrow
                column.setMaxWidth(50);
            }
            else if (i == 2) { // owner name - wide, variable
                column.setPreferredWidth(100);
            }
            else if (i == 3) { // vehicle - middling variable
                column.setPreferredWidth(120);
            }
            else if (i == 4 || i == 6) { // judge inits
                column.setCellRenderer(centerRenderer);
                column.setMaxWidth(70);
            }
            else if (i == 5 || i == 7) { // judge total score
                column.setCellRenderer(centerRenderer);
                column.setMaxWidth(70);
            }
            else { // printed field - narrow
                column.setCellRenderer(centerRenderer);
                column.setMaxWidth(50);
            }
        }
        CarScores.setGridColor(java.awt.Color.blue);
        CarScores.setIntercellSpacing(new Dimension(0,0));
        CarScores.setShowHorizontalLines(true);
        CarScores.setShowVerticalLines(false);
    }
    
    /**
     * formats the ReportTable on the Awards panel for a respectable display.
     */
    private void formatAwardsTable() {
        javax.swing.table.DefaultTableCellRenderer centerRenderer = 
                new javax.swing.table.DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment( javax.swing.JLabel.CENTER );
        ReportTable.setShowHorizontalLines(true);
        ReportTable.setGridColor(java.awt.Color.black);
        ReportTable.setShowVerticalLines(false);
        //final javax.swing.table.TableCellRenderer renderer = ReportTable.getDefaultRenderer();
        javax.swing.table.TableColumn column = null;
        for (int i = 0; i < ReportTable.getColumnModel().getColumnCount(); i++) {
            column = ReportTable.getColumnModel().getColumn(i);
            if (i == 0) {// registration # - narrow
                column.setCellRenderer(centerRenderer);
                column.setMaxWidth(130); // add some flexibility to the Reg# field
                column.setPreferredWidth(85); // so the whole award name will show
                column.setResizable(true); // when resized by user
            }
            else if (i == 1) { // class mnemonic & desc, wide
                column.setPreferredWidth(140);
            }
            else if (i == 3) { // year  - narrow to middling
                column.setMaxWidth(60);
            }
            else if (i == 7) { // judging total score
                column.setCellRenderer(centerRenderer);
                column.setMaxWidth(50);
            }
            else {
                column.setPreferredWidth(90);
            }
        }
    }
    
    /**
     * formats the ClassListTable column widths on the classes admin panel.
     * 
     */
    private void formatClassTable() {
        ClassListTable.setShowHorizontalLines(true);
        //ClassListTable.setGridColor(java.awt.Color.blue);
        ClassListTable.setShowVerticalLines(false);
        ClassListTable.getColumnModel().getColumn(0).setMaxWidth(50);
        ClassListTable.getColumnModel().getColumn(1).setPreferredWidth(90);
        ClassListTable.getColumnModel().getColumn(2).setMaxWidth(60);
        ClassListTable.getColumnModel().getColumn(3).setMaxWidth(60);
    }
    
    /*
     * static object used to enumerate the network interfaces for setIpAddress
     * search of active IP addresses.
     */
    private static java.util.Enumeration<java.net.NetworkInterface> tok; 

    /**
     * Sets the myIpAddress field in the Administration panel.  This relies on having
     * a network setup, otherwise this field will display *NOT CONNECTED*
     * indicating your system is not on any IP network.  This is also the
     * diagnosis of network with CarShow application.
     */

    private void setIpAddress() {
        String[] rets = null;
        try {
            java.util.Stack<String> ipsStack = new java.util.Stack();
            tok = java.net.NetworkInterface.getNetworkInterfaces();
            while(tok != null && tok.hasMoreElements()) {
                java.net.NetworkInterface n = tok.nextElement();
                if(n.isUp() && !n.isLoopback()) {
                    java.util.Enumeration ienum = n.getInetAddresses();
                    while(ienum.hasMoreElements()) {
                        java.net.InetAddress ia = (java.net.InetAddress)ienum.nextElement();
                        if(ia instanceof java.net.Inet4Address || ia instanceof java.net.Inet6Address)
                            ipsStack.add(ia.getHostAddress());
                    } 
                }
            }
            if(!ipsStack.empty()) {
                if(debug) logger.log(Level.INFO, "setIpAddr: ipsStack found {0} addresses", ipsStack.size());
                Iterator<String> iter = ipsStack.iterator();
                while(iter.hasNext()) {
                    String s = iter.next();
                    if ((s.matches("[0-9]{2,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?"))) {    
                        if(rets == null) {
                            rets = new String[1];
                            rets[0] = s;
                        }
                        else {
                            String[] nrets = new String[rets.length+1];
                            System.arraycopy(rets, 0, nrets, 0, rets.length);
                            nrets[rets.length] = s;
                            rets = nrets;
                        }
                    }
                }
            }
            if(rets == null || rets.length == 0) myIpAddress = "*NOT CONNECTED*";
            else if (rets.length == 1) myIpAddress = rets[0];
            else {
                myIpAddress = "";
                for(int i = 0; i < rets.length; i++) myIpAddress = myIpAddress+
                    rets[i]+"  ";
            }
        } catch (java.net.SocketException se) {
            // This is what happens when you don't have a network adaptor?
            //Logger.getLogger(CarShowUI.class.getName()).log(Level.INFO, 
            //    "Unknown host exeception on getLocalHost(), probably not connected...", se);
            myIpAddress="*NOT CONNECTED*";
        }
    }
    
    /**
     * get the string version of the localhost ip address
     * @return the string version of the local system or an empty string
     */
    
    private String getLocalIP() {
        String ret = "";
        InetAddress iaddr;
        try {
            iaddr = InetAddress.getLocalHost();
            if(!iaddr.getHostAddress().equals("127.0.0.1"))  // handle loopback addr reply case
                ret = iaddr.getHostAddress();
        } catch (UnknownHostException ex) {
            Logger.getLogger(CarShowUI.class.getName()).log(Level.SEVERE,
                "getLocalIP: getHostAddress() unknown host exception, ", ex);
        }
        if(debug) System.out.println("getLocalIP: debug ret="+ret);
        return ret;
    }
    /**
     * check if the given string is entirely numeric.  Use to validate years
     * of car classes & year of car entry.
     * @param num value to be checked
     */
    private boolean checkNum(String num) {
        boolean ret = false;
        outer:
        if (!(num == null || num.length() == 0)) {
            for (int i = 0; i < num.length(); i++) {
                if(!Character.isDigit(num.charAt(i)))
                    break outer;
            }
            ret = true;
        }
        return ret;
    }
    
    /**
     * Gets the data for the Administration Panel (carshow name and date)
     * from the DB ShowData table.
     */
    private void getAdminData() {
        if(this.validServer && (this.SQLServer.equals("localhost") ||
                this.SQLServer.equals(getLocalIP()))) {
            ResetEntrantDataButton.setVisible(true);
            ResetEntrantLabel.setVisible(true);
            ArchiveEntrantDataButton.setVisible(true);
            ArchiveEntrantLabel.setVisible(true);
        }
        else {
            ResetEntrantDataButton.setVisible(false);
            ResetEntrantLabel.setVisible(false);
            ArchiveEntrantDataButton.setVisible(false);
            ArchiveEntrantLabel.setVisible(false);
        }
        String request = "select * from "+CarShowConstants.ShowData+";";
        AdminWait.setEnabled(true);
        AdminWait.setVisible(true);
        //sqlGet(AdminPanel, request);
        //waitForIt(AdminWait);
        HashMap[] rs = getDBData(request);
        if(rs.length > 0) setContestResult(rs);
        AdminWait.setEnabled(false);
        AdminWait.setVisible(false);
    }
    
    /**
     * Attribute set to be applied to the printed Awards Report.
     * @param length
     * @return 
     */
    protected SimpleAttributeSet[] initAwardPrintAttributes(int length) {
        //Hard-code some attributes.
        SimpleAttributeSet[] attrs = new SimpleAttributeSet[length];

        attrs[0] = new SimpleAttributeSet(); // single line output for table rows
        StyleConstants.setFontFamily(attrs[0], "Roman");
        StyleConstants.setFontSize(attrs[0], 14);

        attrs[1] = new SimpleAttributeSet(attrs[0]); // Bold 16pt header text
        StyleConstants.setBold(attrs[1], true);
        StyleConstants.setFontSize(attrs[1], 16);

        attrs[2] = new SimpleAttributeSet(attrs[0]); // italics 14pt
        StyleConstants.setItalic(attrs[2], true);

        attrs[3] = new SimpleAttributeSet(attrs[0]); // 20pt Roman
        StyleConstants.setFontSize(attrs[3], 20);

        attrs[4] = new SimpleAttributeSet(attrs[0]); // 12 pt Roman
        StyleConstants.setFontSize(attrs[4], 12);

        attrs[5] = new SimpleAttributeSet(attrs[0]); // 12pt Color RED
        StyleConstants.setForeground(attrs[5], Color.red);

        return attrs;
    }

    /**
     * Get the name of the SQL server as known by the CarShowUI.  This a public
     * that was used in a previous rendition but is mostly deprecated because
     * it is unneeded by any other class/thread but is probably used someplace.
     * @return The name of the SQL server
     */
    
    public String getServer() {
        return SQLServer;
    }

    /*******************************************************************/
    /* Database connection methods and DB Error handlers               */
    /*******************************************************************/

    /**
     * connect to the MySQL host in the network.  The AdminPanel
     * has the ScoringServerName text field containing the name or IP address
     * of the network machine that is hosting the scoring server database.
     * Once connected, the session is kept up between the client and host until
     * the disconnect() method tears down the connection.
     * 
     * There may be systems that do not properly translate the localhost
     * system name into the local IP address (old SuSE Linux systems do
     * this) these systems are dependent on the /etc/hosts table or have
     * broken DNS service connectors.  
     */
    private void connect() {

        String serverName = null;
        if(this.SQLServer == null && in_init) serverName = CarShowConstants.defaultServer;
        else
            serverName = SQLServer;
         if((serverName == null || serverName.equals("")) && !in_init) {
            JOptionPane.showMessageDialog(tabbedPane,
                "No DB host name or IP Address. Please enter" +
                " IP Address (default is localhost)",
                "Error connecting", JOptionPane.ERROR_MESSAGE);
            ScoringServerName.requestFocus();
        }

        InetAddress iaddr = null;
        try {
            if(serverName.equals("localhost")) {
              iaddr = InetAddress.getLocalHost();
            }
            else if(serverName.matches("[0-9]{2,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?\\.[0-9]{1,3}?")) {
              iaddr = InetAddress.getByName(serverName);
            }
            else {
                iaddr = InetAddress.getByName(serverName);
            }
        } catch (UnknownHostException uhe) {
            logger.log(Level.SEVERE, "connect: Unknown Host exception", uhe.toString());
        }
        
        if(this.DBport == null) this.DBport = CarShowConstants.DBport;
        String url = CarShowConstants.DBurlBase+iaddr.getHostAddress()+
            ":"+this.DBport+"/";
        //String dbName = "carshow";
        String dbName = null;
        if(this.DBname != null) dbName = this.DBname;
        else dbName = CarShowConstants.dbName;
        //String driver = "com.mysql.jdbc.Driver";
        String driver = CarShowConstants.DBdriver;
        //String userName = "root";
        String userName = null;
        if(ServerUser == null) userName = CarShowConstants.DBuserName;
        else userName = ServerUser;
        String password = null;
        if(UserPassword == null) password = CarShowConstants.DBpassword;
        else password = UserPassword;

        if(DBconn == null) {
            try {
                //Class.forName("com.mysql.jdbc.Driver").newInstance();
                Class.forName(driver).newInstance();
            }
            catch (ClassNotFoundException cnfe) {
                logger.log(Level.SEVERE,"Mysql driver classs cannot be found,", cnfe);
                return;
            }
            catch (java.lang.InstantiationException ie) {
                logger.log(Level.SEVERE,"Mysql instantiation exception,", ie);
                return;
            }
            catch (java.lang.IllegalAccessException iae) {
                logger.log(Level.SEVERE,"Mysql illegal access execption,",iae);
            }
            try {
                DBconn = DriverManager.getConnection(url+dbName,userName,password);
                DBconn.clearWarnings();
            }
            catch (java.sql.SQLException sqle) {
                logger.log(Level.SEVERE, "SQL exception on db connect,", sqle);
                DBconn = null;
            }
        }        
    }

    /**
     * disconnects from the SQL server
     */
    private void disconnect() {
        try {
            if(DBconn != null)
                DBconn.close();
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Error closing client : {0}", e);
        }
        DBconn = null;
    }

    /**
     * Handler for null pointer exceptions encountered by the SQLClientReader.
     * We have no way of grabbing the SQLiteCommandHandler or SQLiteQS server
     * NPE exceptions so we will rely on a logger to do that.  Since the
     * SQLClientReader is deprecated, this is also.
     * @param ret 
     */
    @Deprecated
    void NPEhandler(int ret) {
        if(tabbedPane != null && ((myJTabbedPane)tabbedPane).getActiveComponent() != null) {
            logger.log(Level.INFO, "NPEhandler: ret: {0}", ret);
            logger.log(Level.INFO, "active pane:{0}",
                ((myJTabbedPane)tabbedPane).getActiveComponent().getName());
            if(((myJTabbedPane)tabbedPane).getActiveComponent() == RegistrationPanel) {
                if(!FirstName.getText().equals("") && !LastName.getText().equals(""))
                    logger.log(Level.INFO,"Re-execution possible on get/set Entrant");
                else logger.log(Level.INFO,"no re-exec possible, user info already lost...");
            }
            else if (((myJTabbedPane)tabbedPane).getActiveComponent() == JudgeSheetPanel ||
                    ((myJTabbedPane)tabbedPane).getActiveComponent() == JudgeSheetSubPanel) {
                // invalid entrant number specified
                logger.log(Level.INFO,"NPEhandler: detected form was JudgingSheets");
                if(JS_EntrantNumber.getText().equals("")) {
                    clearJudgingSheet((byte)7);
                }
            }
            else if (((myJTabbedPane)tabbedPane).getActiveComponent() != null) {
                logger.log(Level.INFO, "NPEhandler detected form was {0}",
                    ((myJTabbedPane)tabbedPane).getActiveComponent().getName());
            }
        }
        else { // this can only hit in init and then only if ClientHandler has an NPE
            if(!in_init | debug) logger.log(Level.WARNING, "NPEhandler: null "+
                "tabbedPane or activeComponent null");
            // tabbedPane == null || getActiveComponent == null
            // initialization phase of SQLiteQS server or DB init 
        }
        // try and correct stack problems caused by an NPE
        // but only the oldest component if more than one
        if(((myJTabbedPane)tabbedPane).getActiveCount() > 1) {
            java.awt.Component c = ((myJTabbedPane)tabbedPane).getTopComponent();
            ((myJTabbedPane)tabbedPane).clearActiveComponent(c);
        }
        else  {
            ((myJTabbedPane)tabbedPane).clearActiveComponent(
                ((myJTabbedPane)tabbedPane).getActiveComponent());
        }
    }
    
    /**
     * Check if the connection can be established to the MySQL server
     * via the JDBC library.  If this fails, we do not have the correct
     * IP address or name of the MySQL server which causes several methods
     * in the CarShowUI to not try and populate internal tables and/or
     * form fields (form tables and drop-downs on the Registration Panel.)
     */
    
    public final boolean checkConnection() {
        boolean ret = false;
        String serverName = null;
        if(in_init && this.SQLServer == null) serverName = CarShowConstants.defaultServer;
        else
            serverName = this.SQLServer;
        
        if((serverName == null || serverName.equals("")) && !in_init) {
            validServer = false;
            return ret;
        }

        InetAddress iaddr = null;
        try {
            if(serverName.equals("localhost")) {
              iaddr = InetAddress.getLocalHost();
            }
            else {
                iaddr = InetAddress.getByName(serverName);
            }
        } catch (UnknownHostException uhe) {
            logger.log(Level.SEVERE, "checkConnection: unknown host exception, {0}", uhe.getMessage());
            // case if invalid host name/bad IP addr...
            //logger.log(Level.SEVERE, "connect: Unknown Host exception", uhe.toString());
            validServer = false;
            return ret;
        }

        String driver = CarShowConstants.DBdriver;
        String userName = null;
        if(ServerUser == null) userName = CarShowConstants.DBuserName;
        else userName = ServerUser;
        String password = null;
        if(UserPassword == null) password = CarShowConstants.DBpassword;
        else password = UserPassword;
                
        //String DBurlBase = "jdbc:mysql://localhost:3306/";
        if(this.DBport == null) this.DBport = CarShowConstants.DBport;
        String url = CarShowConstants.DBurlBase+iaddr.getHostAddress()+
            ":"+this.DBport+"?connectionTimeout="+
            CarShowConstants.ConnectionWaitTime;

        if(DBconn == null) {
            try {
                Class.forName(driver).newInstance();
            }
            catch (ClassNotFoundException cnfe) {
                logger.log(Level.SEVERE,"Mysql driver cannot be found", cnfe);
                validServer = false;
                return ret;
            }
            catch (java.lang.InstantiationException ie) {
                logger.log(Level.SEVERE,"Mysql instantiation exception", ie);
                validServer = false;
                return ret;
            }
            catch (java.lang.IllegalAccessException iae) {
                logger.log(Level.SEVERE,"Mysql illegal access execption",iae);
                validServer = false;
                return ret;
            }
            try {
                DBconn = DriverManager.getConnection(url,userName,password);
                DBconn.clearWarnings();
                ret = true;
                DBconn.close();
                DBconn = null;
                validServer = true;
            }
            catch (java.sql.SQLException sqle) {
                // case if server does not respond / timeout
                //logger.log(Level.SEVERE, "SQL exception on db connect", sqle);
                if(debug) logger.log(Level.SEVERE, "SQLE on DB connect",sqle);
                validServer = false;
                return ret;
            }
        }
        return ret;
    }
    
    /**
     * Checks if the carshow database is present on the SQL server.  If
     * the carshow database is not present this routine will create it
     * using the user specified name/password info from the form or the
     * preferences.xml values.  If the
     * form information is missing, it tries to create the carshow DB
     * using the default DB username and password defined in the
     * CarShowConstants.  NOTE: This requires the user permissions to
     * allow DB Create within the MySQL server.
     * @return true if carshow DB exists or was created successfully
     */
    public boolean checkDBName() {
        boolean needCreate = false;
        boolean ret = false;
        
        if(!this.validServer) {
            return ret;
        }
        String serverName = this.SQLServer;

        InetAddress iaddr = null;
        try {
            if(serverName.equals("localhost")) {
              iaddr = InetAddress.getLocalHost();
            }
            else {
                iaddr = InetAddress.getByName(serverName);
            }
        } catch (UnknownHostException uhe) {
            // case if invalid host name/bad IP addr...
            //logger.log(Level.SEVERE, "connect: Unknown Host exception", uhe.toString());
            this.validServer = false;
            return ret;
        }
        String dbName;
        if(this.DBname != null) {
            dbName = this.DBname;
        }
        else dbName = CarShowConstants.dbName;
        String driver = CarShowConstants.DBdriver;
        String userName = null;
        if(this.ServerUser == null) userName = CarShowConstants.DBuserName;
        else userName = this.ServerUser;
        String password = null;
        if(this.UserPassword == null) password = CarShowConstants.DBpassword;
        else password = this.UserPassword;
        //if(this.)   
        //String url = "jdbc:mysql://localhost:3306/";
        if(this.DBport == null) this.DBport = CarShowConstants.DBport;
        String url = CarShowConstants.DBurlBase+iaddr.getHostAddress()+
            ":"+this.DBport+"?connectionTimeout=3000";

        if(DBconn == null) {
            try {
                Class.forName(driver).newInstance();
            }
            catch (ClassNotFoundException cnfe) {
                logger.log(Level.SEVERE,"Mysql driver cannot be found", cnfe);
                validServer = false;
                return ret;
            }
            catch (java.lang.InstantiationException ie) {
                logger.log(Level.SEVERE,"Mysql instantiation exception", ie);
                validServer = false;
                return ret;
            }
            catch (java.lang.IllegalAccessException iae) {
                logger.log(Level.SEVERE,"Mysql illegal access execption",iae);
                validServer = false;
                return ret;
            }
            try {
                DBconn = DriverManager.getConnection(url,userName,password);
                DBconn.clearWarnings();

            }
            catch (java.sql.SQLException sqle) { // DBconn failed, no server
                logger.log(Level.SEVERE,"SQL Exception on DB getConnection/login",sqle);
                return ret;
            }
            try {
                DBconn.setCatalog(dbName);
                this.DBname = dbName;
                needCreate = false;
                ret = true;
            }
            catch (java.sql.SQLException sqle) {
                // setCatalog failed, needs init
                logger.log(Level.INFO,"SQL Exception opening catalog: "+dbName, sqle);
                needCreate = true;
            }
            if(needCreate) {
                try {
                    String request = "CREATE DATABASE "+dbName+";";
                    java.sql.Statement s = DBconn.createStatement();
                    int q = s.executeUpdate(request);
                    if(q > 0)
                        initDBClasses(true);
                    ret = true;
                }
                catch (java.sql.SQLException sqle) {
                    logger.log(Level.SEVERE, "checkDBName: sql exception on DB create {0}", sqle.getMessage());
                    validServer = false;
                    ret = false;
                }
            }
        }
        return ret;
    }
    

    /**
     * This is a recovery & error return path from the SqlClientReader.  It
     * tries to recover from bad things that happen when the client socket
     * gets trashed during an SQL query/update request.  The logic of how
     * to recover isn't very robust yet so this will need tweaking as DB
     * comm problems trigger this and those are not predictable.
     * @param why reason code
     */
    @Deprecated
    void clientSocketError(int why) {
        if(why < 0) {
            switch (why) {
                case -1:
                    logger.log(Level.SEVERE,"clientSocketError: socket not connected in client");
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
                case -2:
                    logger.log(Level.SEVERE,"clientSocketError: socket closed in/for client");
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
                case -3:
                    logger.log(Level.SEVERE,"clientSocketError: client reader "+
                        "null panel, with result set/return code");
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
                case -4:
                    logger.log(Level.SEVERE,"clientSocketError: client reader "+
                        "unrecognized panel, with result set/return code, active panel:{0}",
                        ((myJTabbedPane)tabbedPane).getActiveComponent().getName());
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
                case -5:
                    logger.log(Level.SEVERE,"clientSocketError: client reader "+
                        "null panel, with result null result set/code");
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
                case -6:
                    //logger.log(Level.SEVERE,"clientSocketError: client reader "+
                    //    "unrecognized non-null panel, with result null result set/code");
                    int cnt = ((myJTabbedPane)tabbedPane).getActiveCount();
                    if(cnt > 0) {
                        if(cnt > 1) {
                            logger.log(Level.SEVERE,"clientSocketError: client reader "+
                        "unrecognized non-null panel, with result null result set/code"+
                                " current aStack size: {0}", cnt);
                        }
                        else {
                            logger.log(Level.SEVERE,"clientSocketError: client"+
                                "reader unrecognized non-null panel, with "+
                                "result null result set/code, active panel:{0}",
                                ((myJTabbedPane)tabbedPane).getActiveComponent().getName());
                        }
                    }
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
                default:
                    logger.log(Level.INFO, "clientSocketError: unknown reason:{0}", why);
                    ((myJTabbedPane)tabbedPane).clearWait();
                    break;
            }
        }
        // We may need more drastic methods here to recover but we don't seem
        // to be taking this path frequently so sync problems may not be
        // alleviated by doing a wipe of the SQL waiting component stack here
        if(((myJTabbedPane)tabbedPane).getActiveCount() > 1) {
            java.awt.Component c = ((myJTabbedPane)tabbedPane).getTopComponent();
            ((myJTabbedPane)tabbedPane).clearActiveComponent(c);
        }
        else  {
            ((myJTabbedPane)tabbedPane).clearActiveComponent(
                ((myJTabbedPane)tabbedPane).getActiveComponent());
        }
    }
    
    /**
     * gets the initialization flag which indicates the UI is in the constructor
     * initialization phase.  This is used by the SqlClientReader class to
     * glean the severity of zero-length return values sent by the 
     * SQLiteCommandHandler (local or remote) during DB initialization.  Of
     * course, this would only be applicable on the localhost (a remote won't
     * be able to initialize the DB) so it may be superceded by a different
     * logical tautology about system state later.
     * @return initialization state of CarShowUI
     */
    @Deprecated
    boolean getInitState() {
        return in_init;
    }
    /**
     * Parses an insert SQL statement.  This is used to reclaim the new
     * entrant number from the DB after an add.
     * @param command
     * @return HashMap of key->value pairs for the table columns to insert
     */
    private HashMap<String,String> parseInsert(String command) {
    	HashMap<String,String> fieldSet = new HashMap<String,String>();
    	int fieldsStart = -1;
    	int fieldsEnd = -1;
    	int valuesStart = -1;
    	fieldsStart = command.indexOf("(");
    	fieldsEnd = command.indexOf(")");
    	valuesStart = command.indexOf("(", fieldsEnd+1);
    	String fieldNames = command.substring(fieldsStart+1, fieldsEnd);
        String values;
        if(command.indexOf(";") > 0)
            values = command.substring(valuesStart+1, command.length()-2);
        else
            values = command.substring(valuesStart+1, command.length()-1);
        String nfn = fieldNames.replaceAll("[ ]*,[ ]*", ",");
        fieldNames = nfn;
        String nv = values.replaceAll("[ ]*,[ ]*",",");
        values = nv;
    	String[] flds = fieldNames.split(",");
    	String[] vals = values.split(",");
    	for (int i = 0; i < flds.length; i++) {
    	    fieldSet.put(flds[i], vals[i]);
    	}
    	return fieldSet;
    }

    /**
     * renders a thick right-hand-side border to table cells
     */
    private static class ThickRightBorderCellRenderer
          extends javax.swing.table.DefaultTableCellRenderer {

        @Override
        public javax.swing.border.Border getBorder() {
            return javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 2, Color.BLACK);
            //return javax.swing.BorderFactory.createLineBorder(Color.BLACK, 2);
        }
    }
    
    /**
     * Class to display the search results from the archive.
     */
        private class ArchiveSearchResults extends javax.swing.JFrame implements ActionListener {
        public javax.swing.JTable resultTable;
        private javax.swing.JButton selButton;
       // private TableColumnAdjuster tca;
        public ArchiveSearchResults() {
            super();
            setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
            setTitle("Entry Search Results");
            getContentPane().setLayout(
            new javax.swing.BoxLayout(this, javax.swing.BoxLayout.PAGE_AXIS));
            getContentPane().setLayout(
                new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));

            ArchiveSelectTableModel astm = new ArchiveSelectTableModel();
            
            resultTable = new javax.swing.JTable(astm);
            resultTable.setPreferredScrollableViewportSize(new Dimension(700, 100));
            resultTable.setFillsViewportHeight(true);
            resultTable.getSelectionModel().addListSelectionListener(new ArchiveSearchResults.RowListener());
            resultTable.setIntercellSpacing(new Dimension(0,0));
            resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            //tca = new TableColumnAdjuster(resultTable);
            javax.swing.table.TableColumn column = null;
            for (int i = 0; i < resultTable.getColumnModel().getColumnCount(); i++) {
                column = resultTable.getColumnModel().getColumn(i);
                column.setHeaderValue(astm.columnNames[i]);
                column.setCellRenderer(new ThickRightBorderCellRenderer());
                if (i == 0) {// first name field
                    column.setMaxWidth(90);
                    column.setMinWidth(60);
                }
                else if (i == 1) { // last name field
                    column.setMaxWidth(90);
                    column.setMinWidth(60);
                }
                else if (i == 2) { // address field
                    //column.setMaxWidth(10);
                    column.setMinWidth(140);
                }
                else if (i == 3) { // city field
                    //column.setMaxWidth(60);
                    column.setMinWidth(80);
                }
                else if (i == 4) { // state field
                    column.setMinWidth(10);
                    column.setMaxWidth(25);
                }
                else if (i == 5) { // zipcode field
                    column.setMinWidth(50);
                }
                else if (i == 6) { // phone field
                    column.setMaxWidth(90);
                }
                else if (i == 7) { // club field
                    column.setMaxWidth(120);
                }
                else {
                    column.setPreferredWidth(60);
                }
            }
            selButton = new javax.swing.JButton("Select");
            selButton.addActionListener(this);
            this.add(new javax.swing.JSeparator(javax.swing.SwingConstants.VERTICAL));
            JScrollPane scrollPane = new JScrollPane(resultTable);
            resultTable.setFillsViewportHeight(true);
            this.add(scrollPane);
            //this.add(resultTable);
            this.add(new javax.swing.JSeparator(javax.swing.SwingConstants.VERTICAL));
            this.add(selButton);
            this.add(new javax.swing.JSeparator(javax.swing.SwingConstants.VERTICAL));
            pack();
        }
        
        @Override
        public void actionPerformed(ActionEvent event) {
            String command = event.getActionCommand();
            if(command.equals("Select")) {
                if(debug) logger.log(Level.INFO,"ArchiveSearchSelect handler actPerf: entry");
                // the selected button has been pressed, gather the selected
                // item from the list and indicate what which entrant to
                // populate the form with...
                int rnum = resultTable.getSelectedRow();
                if(debug) logger.log(Level.INFO, "SelectArchActPerf: rownum:{0}", rnum);
                if(rnum >= 0) {
                    String[] rets = ((ArchiveSelectTableModel)resultTable.getModel()).getRow(rnum);
                    if(debug) logger.log(Level.INFO, "SelectArchActPerf: rets length:{0}", rets.length);
                    StringBuilder sb = new StringBuilder();
                    for(int z = 0; z < rets.length-1; z++)
                        sb.append(rets[z]+",");
                    sb.append(rets[rets.length-1]);
                    this.setEnabled(false);
                    this.setVisible(false);
                    this.setAlwaysOnTop(false);
                    this.dispose();
                    setArchiveEntrant(sb.toString());
                }
            }
        }
        
        private class RowListener implements ListSelectionListener {
            @Override
            public void valueChanged(ListSelectionEvent event) {
                if (event.getValueIsAdjusting()) {
                    return;
                }
                if(debug) logger.log(Level.INFO,"RowListener: ROW SELECTION EVENT. ");
            }
        }
        
        private final static int stdVertOffset = 60;
        private final static int sliderSize = 80;
        public void scaleTable() {
            int rowcnt = resultTable.getRowCount();
            int rowsize = resultTable.getRowHeight();
            int tblsize = rowcnt * rowsize;
            int btnsize = selButton.getHeight();
            int newheight = tblsize + btnsize + stdVertOffset+sliderSize;
            this.setSize(700,newheight); // Width, Height
            //tca.adjustColumns();
        }
    }
    /**
     * Class to present a list of entrants when a search returns multiple
     * results. See the setMultiEntrant() method for usage.  This uses
     * the EntrantSelectTableModel below which has a special storage method
     * allowing us to store the viewed version and a backing original data
     * version of each record.  We pass the original record back to the
     * GUI using the getRawAt() method of EntrantSelectTableModel.
     */
    private class EntrantSearchResults extends javax.swing.JFrame implements ActionListener {

        private javax.swing.JTable resultTable;
        private javax.swing.JButton selButton;    

        public EntrantSearchResults() {
            super();
            setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
            setTitle("Entry Search Results");
            getContentPane().setLayout(
            new javax.swing.BoxLayout(this, javax.swing.BoxLayout.PAGE_AXIS));
            getContentPane().setLayout(
                new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));

            EntrantSelectTableModel estm = new EntrantSelectTableModel();
            resultTable = new javax.swing.JTable(estm);
            resultTable.setPreferredScrollableViewportSize(new Dimension(504, 100));
            resultTable.setFillsViewportHeight(true);
            resultTable.getSelectionModel().addListSelectionListener(new RowListener());
            resultTable.setIntercellSpacing(new Dimension(0,0));
            javax.swing.table.TableColumn column = null;
            for (int i = 0; i < resultTable.getColumnModel().getColumnCount(); i++) {
                column = resultTable.getColumnModel().getColumn(i);
                column.setCellRenderer(new ThickRightBorderCellRenderer());
                if (i == 0) // registration # narrow always
                    column.setMaxWidth(30);
                else if (i == 1) { // car class field narrow
                    column.setMaxWidth(30);
                }
                else if (i == 2) { // firstname
                    column.setPreferredWidth(50);
                }
                else if (i == 3) { // lastname
                    column.setPreferredWidth(60);
                }
                else if (i == 5) { // city field
                    column.setMaxWidth(105);
                }
                else if (i == 6) { // state mnemonic field
                    column.setMaxWidth(30);
                }
                else if (i == 7) { // year field
                    column.setMaxWidth(40);
                }
                else if (i == 8 || i == 9) { // make field
                    column.setMaxWidth(70);
                }
                else {
                    column.setPreferredWidth(60); //model & others
                }
            }
            selButton = new javax.swing.JButton("Select");
            selButton.addActionListener(this);
            this.add(new javax.swing.JSeparator(javax.swing.SwingConstants.VERTICAL));
            JScrollPane scrollPane = new JScrollPane(resultTable);
            resultTable.setFillsViewportHeight(true);
            this.add(scrollPane);
            //this.add(resultTable);
            this.add(new javax.swing.JSeparator(javax.swing.SwingConstants.VERTICAL));
            this.add(selButton);
            this.add(new javax.swing.JSeparator(javax.swing.SwingConstants.VERTICAL));
            pack();
        }
        /**
         * Performs the selection action on the multiple-entrants search results
         * panel/form which is popped-up on a entrant search resulting in
         * multiple entrants.
         * @param event event passed indicating user has clicked a button on
         * the multi-entrant search results form/panel.
         */
        @Override
        public void actionPerformed(ActionEvent event) {
            String command = event.getActionCommand();
            if(command.equals("Select")) {
                if(debug) logger.log(Level.INFO,"Select handler actPerf: entry");
                // the selected button has been pressed, gather the selected
                // item from the list and indicate what which entrant to
                // populate the form with...
                int rnum = resultTable.getSelectedRow();
                if(debug) logger.log(Level.INFO, "SelectActPerf: rownum:{0}", rnum);
                if(rnum >= 0) {
                    String[] rets = ((EntrantSelectTableModel)resultTable.getModel()).getRawAt(rnum);
                    if(debug) logger.log(Level.INFO, "SelectActPerf: rets length:{0}", rets.length);
                    StringBuilder sb = new StringBuilder();
                    for(int z = 0; z < rets.length-1; z++)
                        sb.append(rets[z]+",");
                    sb.append(rets[rets.length-1]);
                    this.setEnabled(false);
                    this.setVisible(false);
                    this.setAlwaysOnTop(false);
                    this.dispose();
                    setEntrant(sb.toString());
                }
            }
        }
        
        /**
         * listener for row selection in the JTable
         */
        private class RowListener implements ListSelectionListener {
            @Override
            public void valueChanged(ListSelectionEvent event) {
                if (event.getValueIsAdjusting()) {
                    return;
                }
                if(debug) logger.log(Level.INFO,"RowListener: ROW SELECTION EVENT. ");
            }
        }
        /**
         * Sets the table height using the number of rows in the table.
         */
        private final static int stdVertOffset = 60;
        public void scaleTable() {
            int rowcnt = resultTable.getRowCount();
            int rowsize = resultTable.getRowHeight();
            int tblsize = rowcnt * rowsize;
            int btnsize = selButton.getHeight();
            int newheight = tblsize + btnsize + stdVertOffset;
            this.setSize(700,newheight);
        }
    }

    /*
     * container class for displaying results of the archived entrant search
     * feature.  Since this table contains only 8 columns of archive data
     * and the entrant search results form/table has 10, a new display frame
     * was needed.
     */
    class ArchiveSelectTableModel extends javax.swing.table.AbstractTableModel {
        
        private int colCount = 8;
        private String[] columnNames = {"First Name","Last Name","Address",
            "City","State","Zip","Phone","Club"};
        private String[][] data = {};
        
        /**
         * remove a row from the archived entrants table data displayed
         * @param i row to delete
         */
        public void removeRow(int i) {
            if(data.length > 0 && i < data.length) {
                for(int j = 0; j < colCount; j++)
                data[i][j] = null;
            }
            data[i] = null;
        }
        /**
         * insert a row into the archived entrants table at index
         * @param i index to insert
         * @param args array of strings to place in columns at index
         */
        public void insertRow(int i, String[] args) {
            if(i < 0) return;
            if(i >= data.length)
                data[i] = new String[colCount];
            if(!args[0].trim().equals("null")) data[i][0] = args[0].trim();
            else data[i][0] = "";
            if(!args[1].trim().equals("null")) data[i][1] = args[1].trim();
            else data[i][1] = "";
            if(!args[2].trim().equals("null")) data[i][2] = args[2].trim();
            else data[i][2] = "";
            if(!args[3].trim().equals("null")) data[i][3] = args[3].trim();
            else data[i][3] = "";
            if(!args[4].trim().equals("null")) data[i][4] = args[4].trim();
            else data[i][4] = "";
            if(!args[5].trim().equals("null")) data[i][5] = args[5].trim();
            else data[i][5] = "";
            if(!args[6].trim().equals("null")) data[i][6] = args[6].trim();
            else data[i][6] = "";
            if(!args[7].trim().equals("null")) data[i][7] = args[7].trim();
            else data[i][7] = "";
        }
        public void addRow(String[] args) {
            int i = data.length;
            if(i == 0) data = new String[1][colCount];
            else {
                int d = data.length + 1;
                String[][] ndata = new String[d][colCount];
                for (int j=0; j < data.length; j++) {
                    System.arraycopy(data[j], 0, ndata[j], 0, colCount);
                }
                data = ndata;
            }
            if(!args[0].trim().equals("null")) data[i][0] = args[0].trim();
            else data[i][0] = "";
            if(!args[1].trim().equals("null")) data[i][1] = args[1].trim();
            else data[i][1] = "";
            if(!args[2].trim().equals("null")) data[i][2] = args[2].trim();
            else data[i][2] = "";
            if(!args[3].trim().equals("null")) data[i][3] = args[3].trim();
            else data[i][3] = "";
            if(!args[4].trim().equals("null")) data[i][4] = args[4].trim();
            else data[i][4] = "";
            if(!args[5].trim().equals("null")) data[i][5] = args[5].trim();
            else data[i][5] = "";
            if(!args[6].trim().equals("null")) data[i][6] = args[6].trim();
            else data[i][6] = "";
            if(!args[7].trim().equals("null")) data[i][7] = args[7].trim();
            else data[i][7] = "";
        }

        @Override
        public int getRowCount() {
            return data.length;
        }

        @Override
        public int getColumnCount() {
            //return columnNames.length;
            return colCount;
        }

        @Override
        public String getColumnName(int columnIndex) {
            return columnNames[columnIndex];
        }
        @Override
        public String getValueAt(int i, int j) {
            return data[i][j];
        }
        
        public String[] getRow(int i) {
            String[] ret = new String[colCount];
            System.arraycopy(data[i], 0, ret, 0, colCount);
            return ret;
        }
        
        public void setValueAt(String aValue, int i, int j) {
            data[i][j] = aValue;
        }
        public void setColumnName(int columnIndex, String label) {
            if(columnIndex > 0 && columnIndex < colCount)
                columnNames[columnIndex] = label;
        }
    }
    /**
     * Table model of the selection panel displayed when multiple entrants are
     * returned on Entrant Search.  The model keeps a visible copy of the
     * entrant data and a raw copy of the entrant data to be given back to
     * setEntrant() when an entrant has been selected from the list.
     */
    private class EntrantSelectTableModel extends javax.swing.table.AbstractTableModel {
        
        private String[] columnNames = {"Registration", "Class",
                                        "First Name", "Last Name", "Address",
                                        "City", "State", "Year","Make", "Model",
                                        };
        private String[][] data = {};
        
        private String[][] rawdata = {};

        public EntrantSelectTableModel() {
            super();
        }
        
        public void removeRow(int i) {
            if(data.length > 0 && i < data.length) {
                for(int j = 0; j < 10; j++)
                data[i][j] = null;
            }
            data[i] = null;
            rawdata[i] = null;
        }
        
        public void insertRow(int i, String[] args) {
            if(i < 0) return;
            if(i >= data.length)
                data[i] = new String[10];
            data[i][0] = args[0].trim();
            data[i][1] = args[3].trim();
            data[i][2] = args[1].trim();
            data[i][3] = args[2].trim();
            data[i][4] = args[4].trim();
            data[i][5] = args[5].trim();
            data[i][6] = args[6].trim();
            data[i][7] = args[12].trim();
            data[i][8] = args[10].trim();
            data[i][9] = args[11].trim();
            if(rawdata.length > i && rawdata[i] == null) rawdata[i] = new String[args.length];
            else {
                String[][] nraw = new String[rawdata.length+1][args.length];
                System.arraycopy(rawdata,0,nraw,0,rawdata.length);
                rawdata=nraw;
            }
            System.arraycopy(args, 0, rawdata[i], 0, args.length);
        }
        /**
         * Add a new row to the table.  This updates both the displayed and
         * backing raw data tables with the string array argument values.
         * @param args array of raw values from DB
         */
        public void addRow(String[] args) {
            int i = data.length;
            if(i == 0) data = new String[1][10];
            else {
                int d = data.length + 1;
                String[][] ndata = new String[d][10];
                for (int j=0; j < data.length; j++) {
                    System.arraycopy(data[j], 0, ndata[j], 0, 10);
                }
                data = ndata;
            }
            // Set the order of info visible in the displayed table here
            data[i][0] = args[0].trim(); // entry #
            data[i][1] = args[3].trim(); // class code
            data[i][2] = args[1].trim(); // firstname
            data[i][3] = args[2].trim(); // lastname
            data[i][4] = args[4].trim(); // address
            data[i][5] = args[5].trim(); // city
            data[i][6] = args[6].trim(); // state
            data[i][7] = args[12].trim(); // year
            data[i][8] = args[9].trim();  // make
            data[i][9] = args[10].trim(); // model
            if(rawdata.length == 0) rawdata = new String[1][args.length];
            else {
                String[][] nraw = new String[rawdata.length+1][args.length];
                System.arraycopy(rawdata,0,nraw,0,rawdata.length);
                rawdata = nraw;
            }
            System.arraycopy(args, 0, rawdata[i], 0, args.length);
        }

        @Override
        public int getRowCount() {
            return data.length;
        }

        @Override
        public int getColumnCount() {
            return columnNames.length;
        }

        @Override
        public String getColumnName(int columnIndex) {
            return columnNames[columnIndex];
        }
        @Override
        public String getValueAt(int i, int j) {
            return data[i][j];
        }
        
        public void setValueAt(String aValue, int i, int j) {
            data[i][j] = aValue;
        }
        public String[] getRawAt(int i) {
            return rawdata[i];
        }
        public void setColumnName(int columnIndex, String label) {
            if(columnIndex > 0 && columnIndex < columnNames.length)
                columnNames[columnIndex] = label;
        }
    }

    /**
     * focus traversal policy for the Registration Panel.
     * Needed due to deprecation of the calls that would chain
     * these in the old standard javax.swing libraries.  This implements the
     * customer's order of field tab selections on the registration panel.
     */
    private static class regLayoutFocusTraversalPolicy extends FocusTraversalPolicy {
        java.util.Vector<Component> order;
 
        public regLayoutFocusTraversalPolicy(java.util.Vector<Component> order) {
            this.order = new java.util.Vector<Component>(order.size());
            this.order.addAll(order);
        }
        @Override
        public Component getComponentAfter(Container focusCycleRoot,
                                           Component aComponent)
        {
            int idx = (order.indexOf(aComponent) + 1) % order.size();
            return order.get(idx);
        }
 
        @Override
        public Component getComponentBefore(Container focusCycleRoot,
                                            Component aComponent)
        {
            int idx = order.indexOf(aComponent) - 1;
            if (idx < 0) {
                idx = order.size() - 1;
            }
            return order.get(idx);
        }
 
        @Override
        public Component getDefaultComponent(Container focusCycleRoot) {
            return order.get(0);
        }
 
        @Override
        public Component getLastComponent(Container focusCycleRoot) {
            return order.lastElement();
        }
 
        @Override
        public Component getFirstComponent(Container focusCycleRoot) {
            return order.get(0);
        }
    }
    
    /**
     * typedKeyListener class, listens to the keyboard inputs and selectively
     * offers up choices in that jTextField or jComboBox object.  Currently
     * this gets used to offer choices in the EntrantClubs jComboBox and
     * registration number jTextField on the Registration Panel, and the Judging
     * Sheet registration number and ScoringServerName on the Administration panel.
     * 
     * EntrantClubs selects from the available know clubs using entered characters.
     * 
     * This implements the search capability on the Judging Sheet panel
     * when a user enters an entrant number and presses Enter to initiate the
     * look-up of that entrant's scoring data.
     * 
     * It also implements a similar search capability on the Registration panel
     * for the entrant number field on that screen, which is also provided
     * via the focusLost (tab-out) capability of that Registration entrant #
     * field.
     */
    private class typedKeyListener implements KeyEventPostProcessor {
        private String lastStr;
        @Override
        public boolean postProcessKeyEvent(KeyEvent e) {
            if(e.getID() != 0) {
                if(debug) System.err.println("postProcKeyEvent: id is:"+e.getID());
                if(e.getID() == KeyEvent.KEY_TYPED) {
                    Object c = e.getSource();
                    // an edittable jComboBox uese a jTextField for input
                    // the jComboBox is its parent object
                    if(c instanceof javax.swing.JTextField) {
                        String cname = ((javax.swing.JTextField)c).getName();
                        if(debug) logger.log(Level.INFO,"source is a jtext field");
                        if(debug) logger.log(Level.INFO,"name is: {0}",((javax.swing.JTextField)c).getName());
                        Component pc = ((javax.swing.JTextField)c).getParent();
                        //if(pc == EntrantClub) {
                        if(pc.getName().equals("EntrantClub")) {
                            if(debug) logger.log(Level.INFO,"parent was entrant club");
                            char inChar = e.getKeyChar();
                            // sift activeClubs to find matching preamble chars
                            String curStr = ((javax.swing.JTextField)c).getText();
                            if(curStr.equals(lastStr)) {
                                // This is a hack to fix cases where we are over applying bkspace
                                if(debug) logger.log(Level.WARNING,"Applying \"{0}\" to same string",inChar);
                                return false;
                            }
                            //else lastStr = curStr;
                            int clubcnt = EntrantClub.getItemCount();
                            String[] clublist = new String[clubcnt];
                            for(int n = 0; n < clubcnt; n++) {
                                clublist[n] = ((String)EntrantClub.getItemAt(n)).trim().toLowerCase();
                            }
                            if(curStr.trim().length() > 0) { // new club name isn't spaces
                                String l = curStr.substring(curStr.length()-1);
                                char lchar = l.charAt(0);
                                if(debug) logger.log(Level.INFO,"last char of typed is \"{0}\"",inChar);
                                if(debug) logger.log(Level.INFO,"last char of curStr: {0}",lchar);
                                if(inChar == '\b') {//  && curStr.trim().length() == 2) {
                                    if(debug) logger.log(Level.INFO, "applying a bkspace to \"{0}\"",curStr.trim());
                                    curStr = curStr.substring(0,curStr.length()-1);
                                }
                                if(curStr.isEmpty()) {
                                    ((javax.swing.JTextField)c).setText("");
                                }
                                else {
                                    String prefix = curStr.toLowerCase();
                                    int pos = prefix.length();
                                    for(int n = 0; n < clubcnt; n++) {
                                        if(clublist[n].startsWith(prefix)) {
                                            ((javax.swing.JTextField)c).setText((String)EntrantClub.getItemAt(n));
                                            ((javax.swing.JTextField)c).setCaretPosition(pos);
                                            ((javax.swing.JTextField)c).setSelectionStart(pos);
                                            ((javax.swing.JTextField)c).setSelectionEnd(clublist[n].length());
                                            break;
                                        }
                                    }
                                }
                                lastStr = curStr;
                            }
                            else {
                                if(debug) logger.log(Level.WARNING,"keyListener: curChars last char isnt a Char, curChars: {0}",curStr);
                                if(debug) logger.log(Level.WARNING,"inChar: {0}",inChar);
                            }
                        }
                        else if (cname != null && cname.equals("ScoringServerName")) {
                            // Admin Panel scoring server name behavior, clear field
                            // color when changing server name on form
                            if(debug) System.err.println("ScoringServerNameField key Entry detected");
                            ScoringServerName.setBackground(Color.WHITE);
                        }
                        else if (cname != null && cname.equals("JS_EntrantNumber")) {
                            // Judging Sheet Panel Key Action Handler
                            // PERFORM SEARCH FOR ENTRANT # HERE IF KEY IS \n
                            // ACTIATE A SCORING UPDATE/ENTRY SEARCH REQUEST
                            // Need a new event queued to do the search
                            // since its the same as a focusLost, use that handler!
                            char kch = e.getKeyChar();
                            if(kch == '\n') {
                                java.awt.event.FocusEvent nevt = 
                                    new java.awt.event.FocusEvent(JS_EntrantNumber,
                                    java.awt.event.FocusEvent.FOCUS_LOST);
                                java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(nevt);
                            }
                        }
                        else if (cname != null && cname.equals("EntrantNumber")) {
                            char kch = e.getKeyChar();
                            if(kch == '\n') {
                                java.awt.event.FocusEvent nevt = 
                                    new java.awt.event.FocusEvent(EntrantNumber,
                                    java.awt.event.FocusEvent.FOCUS_LOST);
                                java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(nevt);
                            }
                        }
                    }
                }
            }
            return false;
        }
    }
}
